[gtk/wip/otte/undo: 8/17] entry: Don't merge undo commands with different cursors



commit 0ce285d7f1ec11fa2cd5759769d0f2d4909669ff
Author: Benjamin Otte <otte redhat com>
Date:   Sun Aug 16 07:32:27 2015 +0200

    entry: Don't merge undo commands with different cursors
    
    If the user moves the cursor between undo commands, don't merge them.
    This is what other implementations do, so mirror them.

 gtk/gtkentryundocommand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkentryundocommand.c b/gtk/gtkentryundocommand.c
index 6a902ea38d..e7812cf617 100644
--- a/gtk/gtkentryundocommand.c
+++ b/gtk/gtkentryundocommand.c
@@ -134,7 +134,9 @@ gtk_entry_undo_command_merge (GtkUndoCommand *command,
   if (command_priv->entry != followup_priv->entry)
     return NULL;
 
-  if (!g_str_equal (command_priv->after.text, followup_priv->before.text))
+  if (!g_str_equal (command_priv->after.text, followup_priv->before.text) ||
+      command_priv->after.cursor != followup_priv->before.cursor ||
+      command_priv->after.selection_start != followup_priv->before.selection_start)
     return NULL;
 
   /* We don't insist on cursor positions being equal here, someone


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