[gtksourceview] vim: propagate command count to motion
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: propagate command count to motion
- Date: Fri, 12 Nov 2021 08:05:05 +0000 (UTC)
commit 49d5bf2c472abaa4ba1cb979103ad1848eb37acd
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 12 00:04:57 2021 -0800
vim: propagate command count to motion
If we got something like 100dj we actually want d100j to have the most
consistency with what users expect.
gtksourceview/vim/gtksourcevimcommand.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtksourcevimcommand.c b/gtksourceview/vim/gtksourcevimcommand.c
index 2f9f09e1..cd86ea8b 100644
--- a/gtksourceview/vim/gtksourcevimcommand.c
+++ b/gtksourceview/vim/gtksourcevimcommand.c
@@ -1254,11 +1254,22 @@ gtk_source_vim_command_resume (GtkSourceVimState *state,
g_assert (GTK_SOURCE_IS_VIM_COMMAND (self));
g_assert (GTK_SOURCE_IS_VIM_STATE (from));
- /* Complete if waiting for a motion */
+ /* Complete if waiting for a motion. If we had a count, instead
+ * move it to the motion.
+ */
if (GTK_SOURCE_IS_VIM_MOTION (from) && self->motion == NULL)
{
+ int count = gtk_source_vim_state_get_count (state);
+
+ if (count > 1)
+ {
+ gtk_source_vim_state_set_count (from, count);
+ gtk_source_vim_state_set_count (state, 0);
+ }
+
gtk_source_vim_state_reparent (from, state, &self->motion);
gtk_source_vim_state_pop (state);
+
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]