[gimp] Move the cursor to the logical end of the selection when cancelling it



commit 473b5122ae15a24efec46692fc4fac8b7d110484
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 15 11:59:58 2009 +0200

    Move the cursor to the logical end of the selection when cancelling it
    
    gimp_text_tool_move_cursor(): when there is something selected, and
    cursor movement does not extend that selection, move the cursor to the
    end of the selection that is in moving direction. This it *not*
    how GtkTextView behaves, but it should, see bug #50942.

 app/tools/gimptexttool.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 761f8b6..fb351bf 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -1431,9 +1431,22 @@ gimp_text_tool_move_cursor (GimpTextTool    *text_tool,
                                     gtk_text_buffer_get_selection_bound (buffer));
 
   if (extend_selection)
-    sel_start = &selection;
+    {
+      sel_start = &selection;
+    }
   else
-    sel_start = &cursor;
+    {
+      /*  when there is a selection, moving the cursor without
+       *  extending it should move the cursor to the end of the
+       *  selection that is in moving direction
+       */
+      if (count > 0)
+        gtk_text_iter_order (&selection, &cursor);
+      else
+        gtk_text_iter_order (&cursor, &selection);
+
+      sel_start = &cursor;
+    }
 
   switch (step)
     {



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