[gtksourceview/wip/chergert/vim] move user actions to where they are used
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] move user actions to where they are used
- Date: Fri, 29 Oct 2021 19:41:04 +0000 (UTC)
commit 5b522741722ea834a63f5402ee0038e6c7bacc5b
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 29 12:39:47 2021 -0700
move user actions to where they are used
gtksourceview/vim/gtk-source-vim-command.c | 4 ++++
gtksourceview/vim/gtk-source-vim-delete.c | 4 ++++
gtksourceview/vim/gtk-source-vim-insert.c | 3 +++
gtksourceview/vim/gtk-source-vim-normal.c | 9 +--------
gtksourceview/vim/gtk-source-vim-replace.c | 2 ++
5 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-command.c b/gtksourceview/vim/gtk-source-vim-command.c
index 01bfa9e6..770df1c1 100644
--- a/gtksourceview/vim/gtk-source-vim-command.c
+++ b/gtksourceview/vim/gtk-source-vim-command.c
@@ -59,6 +59,8 @@ gtk_source_vim_command_join (GtkSourceVimCommand *self)
buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, &selection);
+ gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer));
+
gtk_text_iter_order (&iter, &selection);
offset = gtk_text_iter_get_offset (&iter);
@@ -70,6 +72,8 @@ gtk_source_vim_command_join (GtkSourceVimCommand *self)
gtk_source_buffer_join_lines (buffer, &iter, &selection);
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &iter, offset);
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer), &iter, &iter);
+
+ gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
}
static void
diff --git a/gtksourceview/vim/gtk-source-vim-delete.c b/gtksourceview/vim/gtk-source-vim-delete.c
index 779892ab..a42d7b72 100644
--- a/gtksourceview/vim/gtk-source-vim-delete.c
+++ b/gtksourceview/vim/gtk-source-vim-delete.c
@@ -163,6 +163,8 @@ gtk_source_vim_delete_leave (GtkSourceVimState *state)
g_assert (GTK_SOURCE_IS_VIM_DELETE (state));
gtk_source_vim_delete_repeat (state);
+
+ gtk_source_vim_state_end_user_action (state);
}
static void
@@ -172,6 +174,8 @@ gtk_source_vim_delete_enter (GtkSourceVimState *state)
g_assert (GTK_SOURCE_IS_VIM_DELETE (self));
+ gtk_source_vim_state_begin_user_action (state);
+
if (self->motion == NULL)
gtk_source_vim_state_push (state, gtk_source_vim_motion_new ());
}
diff --git a/gtksourceview/vim/gtk-source-vim-insert.c b/gtksourceview/vim/gtk-source-vim-insert.c
index 1cd544e7..0270ab00 100644
--- a/gtksourceview/vim/gtk-source-vim-insert.c
+++ b/gtksourceview/vim/gtk-source-vim-insert.c
@@ -281,6 +281,7 @@ gtk_source_vim_insert_enter (GtkSourceVimState *state)
g_assert (GTK_SOURCE_IS_VIM_INSERT (self));
+ gtk_source_vim_state_begin_user_action (state);
gtk_source_vim_state_set_overwrite (state, FALSE);
g_clear_object (&self->history);
@@ -308,6 +309,8 @@ gtk_source_vim_insert_leave (GtkSourceVimState *state)
gtk_source_vim_text_history_replay (self->history);
}
gtk_source_vim_state_pop (history);
+
+ gtk_source_vim_state_end_user_action (state);
}
static void
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index 5eeef980..1f27d4cc 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -971,14 +971,9 @@ static void
gtk_source_vim_normal_suspend (GtkSourceVimState *state,
GtkSourceVimState *to)
{
- GtkSourceVimNormal *self = (GtkSourceVimNormal *)state;
- GtkSourceBuffer *buffer;
-
- g_assert (GTK_SOURCE_IS_VIM_NORMAL (self));
+ g_assert (GTK_SOURCE_IS_VIM_NORMAL (state));
g_assert (GTK_SOURCE_IS_VIM_STATE (to));
- buffer = gtk_source_vim_state_get_buffer (state, NULL, NULL);
- gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer));
}
static void
@@ -997,8 +992,6 @@ gtk_source_vim_normal_resume (GtkSourceVimState *state,
insert = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
view = gtk_source_vim_state_get_view (state);
- gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
-
/* Go back one character if we exited replace/insert state */
if (GTK_SOURCE_IS_VIM_INSERT (from) || GTK_SOURCE_IS_VIM_REPLACE (from))
go_backward_char (self);
diff --git a/gtksourceview/vim/gtk-source-vim-replace.c b/gtksourceview/vim/gtk-source-vim-replace.c
index a284f5fe..5818a57c 100644
--- a/gtksourceview/vim/gtk-source-vim-replace.c
+++ b/gtksourceview/vim/gtk-source-vim-replace.c
@@ -96,6 +96,7 @@ gtk_source_vim_replace_enter (GtkSourceVimState *state)
g_assert (GTK_SOURCE_IS_VIM_REPLACE (state));
gtk_source_vim_state_set_overwrite (state, TRUE);
+ gtk_source_vim_state_begin_user_action (state);
}
static void
@@ -106,6 +107,7 @@ gtk_source_vim_replace_resume (GtkSourceVimState *state,
g_assert (GTK_SOURCE_IS_VIM_REPLACE (from));
gtk_source_vim_state_set_overwrite (state, TRUE);
+ gtk_source_vim_state_end_user_action (state);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]