[gnome-commander] Fixed text selection in int. viewer on lines with TAB characters



commit 5cd72aec308eb5b190bf6353ff149c4dcf6169b1
Author: Jan Vleeshouwers <jamavlers gmail com>
Date:   Tue Apr 8 17:17:20 2014 +0200

    Fixed text selection in int. viewer on lines with TAB characters
    
    Signed-off-by: Uwe Scholz <uwescholz src gnome org>

 NEWS                         |   14 ++++++++++++++
 doc/C/releases.xml           |   33 ++++++++++++++++++++++++++++++++-
 src/intviewer/text-render.cc |   21 +++++++++++++++------
 3 files changed, 61 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index fa8b888..ac2ab8e 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,20 @@ New features:
      ...            ...
 
 ===================================
+gnome-commander 1.4.2
+---------------
+
+Bug fixes:
+ * Fixed problem bgo#367949 (Corrected async_xfer_callback-results for mooving folders)
+ * Fixed problem bgo#598161 (Selecting text in internal viewer on lines with TAB characters)
+New features:
+* New or updated translations: 
+     ...
+* New key bindings:
+     ...            ...
+
+
+===================================
 gnome-commander 1.4.1
 ---------------
 
diff --git a/doc/C/releases.xml b/doc/C/releases.xml
index 7b04dc7..7270975 100644
--- a/doc/C/releases.xml
+++ b/doc/C/releases.xml
@@ -51,13 +51,44 @@
             </entry>
         </row>
         <row valign="top">
-            <entry><para>1.4.1</para></entry>
+            <entry><para>1.4.2</para></entry>
             <entry><para>2014-??-??</para></entry>
             <entry>
                 <para>Bug fixes:</para>
                 <para>
                     <itemizedlist>
                         <listitem>
+                            <para> Fixed problem bgo#367949 (Corrected async_xfer_callback-results for 
mooving folders)</para>
+                        </listitem>
+                        <listitem>
+                            <para> Fixed problem bgo#598161 (Selecting text in internal viewer on lines with 
TAB characters)</para>
+                       </listitem>
+                    </itemizedlist>
+                </para>
+                <para>New features:</para>
+                <para>
+                    <itemizedlist>
+                        <listitem>
+                            <para>???</para>
+                        </listitem>
+                        <listitem>
+                            <para>New or updated docs: ??</para>
+                        </listitem>
+                        <listitem>
+                            <para>New or updated translations: ??</para>
+                        </listitem>
+                    </itemizedlist>
+                </para>
+            </entry>
+        </row>
+        <row valign="top">
+            <entry><para>1.4.1</para></entry>
+            <entry><para>2014-04-05</para></entry>
+            <entry>
+                <para>Bug fixes:</para>
+                <para>
+                    <itemizedlist>
+                        <listitem>
                             <para>Fixed problem bgo#641842 (Use poppler-glib instead of poppler internal 
API)</para>
                         </listitem>
                         <listitem>
diff --git a/src/intviewer/text-render.cc b/src/intviewer/text-render.cc
index 0e4f175..8983e92 100644
--- a/src/intviewer/text-render.cc
+++ b/src/intviewer/text-render.cc
@@ -1528,6 +1528,8 @@ static offset_type text_mode_pixel_to_offset(TextRender *obj, int x, int y, gboo
     int column = 0;
     offset_type offset;
     offset_type next_line_offset;
+    char_type choff; // character at offset
+    int choffcol = 0; // last column occupied by choff
 
     if (x<0)
         x = 0;
@@ -1541,20 +1543,27 @@ static offset_type text_mode_pixel_to_offset(TextRender *obj, int x, int y, gboo
         return obj->priv->current_offset;
 
     line = y / obj->priv->char_height;
-    column = x / obj->priv->char_width;
-
-    if (!start_marker)
-        column++;
+    column = x / obj->priv->char_width + obj->priv->column;
 
+    // Determine offset corresponding to start of line, the character at this offset and the last column 
occupied by character
     offset = gv_scroll_lines (obj->priv->dp, obj->priv->current_offset, line);
+    choff = gv_input_mode_get_utf8_char(obj->priv->im, offset);
+    choffcol = (choff=='\t') ? obj->priv->tab_size-1 : 0;
+
     next_line_offset = gv_scroll_lines (obj->priv->dp, offset, 1);
 
-    while (column>0 && offset<next_line_offset)
+    // While the current character does not occupy column 'column', check next character
+    while (column>choffcol && offset<next_line_offset)
     {
         offset = gv_input_get_next_char_offset(obj->priv->im, offset);
-        column--;
+       choff = gv_input_mode_get_utf8_char(obj->priv->im, offset);
+       choffcol += (choff=='\t') ? obj->priv->tab_size : 1;
     }
 
+    // Increment offset if doing end-marker
+    if (!start_marker)
+        offset++;
+
     return offset;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]