[gtksourceview/wip/chergert/vim] implement repeat for states that can be repeated with .
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] implement repeat for states that can be repeated with .
- Date: Fri, 29 Oct 2021 20:00:01 +0000 (UTC)
commit 5c564b4edbc008b8de708addbcb5ac42bd05456f
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 29 12:59:56 2021 -0700
implement repeat for states that can be repeated with .
gtksourceview/vim/gtk-source-vim-normal.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index 3d1ed32c..f4bb1cc7 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -42,6 +42,7 @@ struct _GtkSourceVimNormal
{
GtkSourceVimState parent_instance;
GString *command_text;
+ GtkSourceVimState *repeat;
KeyHandler handler;
int count;
guint has_count : 1;
@@ -400,10 +401,17 @@ key_handler_command (GtkSourceVimNormal *self,
}
break;
+ case GDK_KEY_period:
+ if (self->repeat != NULL)
+ {
+ gtk_source_vim_state_repeat (self->repeat);
+ return TRUE;
+ }
+ break;
+
case GDK_KEY_asciitilde:
case GDK_KEY_p:
case GDK_KEY_P:
- case GDK_KEY_period:
case GDK_KEY_equal:
case GDK_KEY_plus:
case GDK_KEY_Y:
@@ -952,10 +960,17 @@ gtk_source_vim_normal_resume (GtkSourceVimState *state,
/* 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);
+ }
/* Always scroll the insert mark onscreen */
gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (view), insert);
+
+ if (gtk_source_vim_state_get_can_repeat (from))
+ {
+ g_set_object (&self->repeat, from);
+ }
}
static void
@@ -988,6 +1003,7 @@ gtk_source_vim_normal_dispose (GObject *object)
{
GtkSourceVimNormal *self = (GtkSourceVimNormal *)object;
+ g_clear_object (&self->repeat);
g_string_free (self->command_text, TRUE);
self->command_text = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]