[gtksourceview/wip/chergert/vim] put inserts into single undo group



commit 8ed6e40d80730753a31d970096accbfd44708d29
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 27 07:40:16 2021 -0700

    put inserts into single undo group

 gtksourceview/vim/gtk-source-vim-insert.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-insert.c b/gtksourceview/vim/gtk-source-vim-insert.c
index cbca287e..022723c8 100644
--- a/gtksourceview/vim/gtk-source-vim-insert.c
+++ b/gtksourceview/vim/gtk-source-vim-insert.c
@@ -152,9 +152,25 @@ gtk_source_vim_insert_resume (GtkSourceVimState *state,
 static void
 gtk_source_vim_insert_enter (GtkSourceVimState *state)
 {
+       GtkSourceBuffer *buffer;
+
        g_assert (GTK_SOURCE_IS_VIM_INSERT (state));
 
        gtk_source_vim_state_set_overwrite (state, FALSE);
+
+       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_insert_leave (GtkSourceVimState *state)
+{
+       GtkSourceBuffer *buffer;
+
+       g_assert (GTK_SOURCE_IS_VIM_INSERT (state));
+
+       buffer = gtk_source_vim_state_get_buffer (state, NULL, NULL);
+       gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
 }
 
 static void
@@ -174,6 +190,7 @@ gtk_source_vim_insert_class_init (GtkSourceVimInsertClass *klass)
        state_class->handle_event = gtk_source_vim_insert_handle_event;
        state_class->resume = gtk_source_vim_insert_resume;
        state_class->enter = gtk_source_vim_insert_enter;
+       state_class->leave = gtk_source_vim_insert_leave;
 }
 
 static void


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