[text] Maintain the cursor at the end when deleting
authorEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 14 May 2009 11:00:51 +0000 (12:00 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 14 May 2009 11:00:51 +0000 (12:00 +0100)
If the cursor is already at the end of the Text contents then we
need to maintain its position when deleting the previous character
using the relative key binding.

clutter/clutter-text.c

index b9b5428..5b0aa14 100644 (file)
@@ -1765,17 +1765,17 @@ clutter_text_real_del_prev (ClutterText         *self,
     {
       if (pos == -1)
         {
-          clutter_text_set_cursor_position (self, len - 1);
-          clutter_text_set_selection_bound (self, len - 1);
-
           clutter_text_delete_text (self, len - 1, len);
+
+          clutter_text_set_cursor_position (self, -1);
+          clutter_text_set_selection_bound (self, -1);
         }
       else
         {
+          clutter_text_delete_text (self, pos - 1, pos);
+
           clutter_text_set_cursor_position (self, pos - 1);
           clutter_text_set_selection_bound (self, pos - 1);
-
-          clutter_text_delete_text (self, pos - 1, pos);
         }
     }