[gtksourceview/wip/chergert/vim] capture motion for commands when resuming
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] capture motion for commands when resuming
- Date: Fri, 29 Oct 2021 23:44:49 +0000 (UTC)
commit 21fe1e3ba59680f41f60fd332a3860333844c480
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 29 16:44:11 2021 -0700
capture motion for commands when resuming
gtksourceview/vim/gtk-source-vim-command.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-command.c b/gtksourceview/vim/gtk-source-vim-command.c
index 5279c704..4ea9c6c0 100644
--- a/gtksourceview/vim/gtk-source-vim-command.c
+++ b/gtksourceview/vim/gtk-source-vim-command.c
@@ -342,6 +342,23 @@ gtk_source_vim_command_leave (GtkSourceVimState *state)
gtk_source_vim_command_repeat (state);
}
+static void
+gtk_source_vim_command_resume (GtkSourceVimState *state,
+ GtkSourceVimState *from)
+{
+ GtkSourceVimCommand *self = (GtkSourceVimCommand *)state;
+
+ g_assert (GTK_SOURCE_IS_VIM_COMMAND (self));
+ g_assert (GTK_SOURCE_IS_VIM_STATE (from));
+
+ /* Complete if waiting for a motion */
+ if (GTK_SOURCE_IS_VIM_MOTION (from) && self->motion == NULL)
+ {
+ g_set_object (&self->motion, GTK_SOURCE_VIM_MOTION (from));
+ gtk_source_vim_state_pop (state);
+ }
+}
+
static void
gtk_source_vim_command_dispose (GObject *object)
{
@@ -422,6 +439,7 @@ gtk_source_vim_command_class_init (GtkSourceVimCommandClass *klass)
state_class->enter = gtk_source_vim_command_enter;
state_class->leave = gtk_source_vim_command_leave;
state_class->repeat = gtk_source_vim_command_repeat;
+ state_class->resume = gtk_source_vim_command_resume;
properties [PROP_COMMAND] =
g_param_spec_string ("command",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]