[gtksourceview/wip/chergert/vim] implement repeat for delete
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] implement repeat for delete
- Date: Thu, 28 Oct 2021 00:08:13 +0000 (UTC)
commit 46f16ffab1044d81e192b88c9b6d2333e5b645b8
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 27 16:43:52 2021 -0700
implement repeat for delete
gtksourceview/vim/gtk-source-vim-delete.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-delete.c b/gtksourceview/vim/gtk-source-vim-delete.c
index 91ac0ca7..4993499f 100644
--- a/gtksourceview/vim/gtk-source-vim-delete.c
+++ b/gtksourceview/vim/gtk-source-vim-delete.c
@@ -126,7 +126,8 @@ gtk_source_vim_delete_resume (GtkSourceVimState *state,
}
static void
-gtk_source_vim_delete_leave (GtkSourceVimState *state)
+gtk_source_vim_delete_repeat (GtkSourceVimState *state,
+ int repeat)
{
GtkSourceVimDelete *self = (GtkSourceVimDelete *)state;
GtkSourceBuffer *buffer;
@@ -137,7 +138,10 @@ gtk_source_vim_delete_leave (GtkSourceVimState *state)
if (self->motion != NULL)
{
buffer = gtk_source_vim_state_get_buffer (state, &insert, &selection);
- gtk_source_vim_motion_apply (self->motion, &insert, TRUE);
+ do
+ {
+ gtk_source_vim_motion_apply (self->motion, &insert, TRUE);
+ } while (--repeat > 0);
gtk_text_buffer_delete (GTK_TEXT_BUFFER (buffer), &insert, &selection);
if (gtk_text_iter_ends_line (&insert) &&
@@ -149,6 +153,14 @@ gtk_source_vim_delete_leave (GtkSourceVimState *state)
}
}
+static void
+gtk_source_vim_delete_leave (GtkSourceVimState *state)
+{
+ g_assert (GTK_SOURCE_IS_VIM_DELETE (state));
+
+ gtk_source_vim_delete_repeat (state, 0);
+}
+
static void
gtk_source_vim_delete_enter (GtkSourceVimState *state)
{
@@ -180,6 +192,7 @@ gtk_source_vim_delete_class_init (GtkSourceVimDeleteClass *klass)
object_class->get_property = gtk_source_vim_delete_get_property;
object_class->set_property = gtk_source_vim_delete_set_property;
+ state_class->repeat = gtk_source_vim_delete_repeat;
state_class->resume = gtk_source_vim_delete_resume;
state_class->enter = gtk_source_vim_delete_enter;
state_class->leave = gtk_source_vim_delete_leave;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]