[gtksourceview/wip/chergert/vim] group edits into single undo group from replace



commit bf734c10e2c7c14f31a8d5f33d0bbc192b21dca7
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 27 12:26:52 2021 -0700

    group edits into single undo group from replace

 gtksourceview/vim/gtk-source-vim-replace.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-replace.c b/gtksourceview/vim/gtk-source-vim-replace.c
index 3cdd28b1..be966d6c 100644
--- a/gtksourceview/vim/gtk-source-vim-replace.c
+++ b/gtksourceview/vim/gtk-source-vim-replace.c
@@ -91,9 +91,25 @@ gtk_source_vim_replace_handle_keypress (GtkSourceVimState *state,
 static void
 gtk_source_vim_replace_enter (GtkSourceVimState *state)
 {
+       GtkSourceBuffer *buffer;
+
        g_assert (GTK_SOURCE_IS_VIM_REPLACE (state));
 
        gtk_source_vim_state_set_overwrite (state, TRUE);
+
+       buffer = gtk_source_vim_state_get_buffer (state, NULL, NULL);
+       gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer));
+}
+
+static void
+gtk_source_vim_replace_leave (GtkSourceVimState *state)
+{
+       GtkSourceBuffer *buffer;
+
+       g_assert (GTK_SOURCE_IS_VIM_REPLACE (state));
+
+       buffer = gtk_source_vim_state_get_buffer (state, NULL, NULL);
+       gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
 }
 
 static void
@@ -113,6 +129,7 @@ gtk_source_vim_replace_class_init (GtkSourceVimReplaceClass *klass)
 
        state_class->handle_keypress = gtk_source_vim_replace_handle_keypress;
        state_class->enter = gtk_source_vim_replace_enter;
+       state_class->leave = gtk_source_vim_replace_leave;
        state_class->resume = gtk_source_vim_replace_resume;
 }
 


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