texthistory: always track selection bounds
authorChristian Hergert <chergert@redhat.com>
Sun, 26 Dec 2021 20:47:45 +0000 (12:47 -0800)
committerChristian Hergert <chergert@redhat.com>
Sun, 26 Dec 2021 20:47:45 +0000 (12:47 -0800)
It's cheap to store the selection position, so always set it even if we
are in a user section. Otherwise, we risk not having the right position
when starting a delete action within a begin_user_action(),
end_user_action() pair.

Related #4575

gtk/gtktexthistory.c

index 3b9379ccc3d255912b68a0aa6aa8038604902603..5f3f2cb56cd8540da968b6b8dd72d787a97d1162 100644 (file)
@@ -981,11 +981,8 @@ gtk_text_history_selection_changed (GtkTextHistory *self,
   return_if_applying (self);
   return_if_irreversible (self);
 
-  if (self->in_user == 0 && self->irreversible == 0)
-    {
-      self->selection.insert = CLAMP (selection_insert, -1, G_MAXINT);
-      self->selection.bound = CLAMP (selection_bound, -1, G_MAXINT);
-    }
+  self->selection.insert = CLAMP (selection_insert, -1, G_MAXINT);
+  self->selection.bound = CLAMP (selection_bound, -1, G_MAXINT);
 }
 
 void