[gtksourceview/wip/chergert/vim: 279/293] ignore cursor state for indent
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 279/293] ignore cursor state for indent
- Date: Fri, 5 Nov 2021 04:23:08 +0000 (UTC)
commit 3f094bdac861c1055ef1096cade69f867a88fcc7
Author: Christian Hergert <chergert redhat com>
Date: Wed Nov 3 17:13:39 2021 -0700
ignore cursor state for indent
gtksourceview/vim/gtk-source-vim-visual.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-visual.c b/gtksourceview/vim/gtk-source-vim-visual.c
index 7ef3d4ae..35c26c62 100644
--- a/gtksourceview/vim/gtk-source-vim-visual.c
+++ b/gtksourceview/vim/gtk-source-vim-visual.c
@@ -353,7 +353,8 @@ key_handler_register (GtkSourceVimVisual *self,
static gboolean
gtk_source_vim_visual_begin_command (GtkSourceVimVisual *self,
- const char *command)
+ const char *command,
+ gboolean restore_cursor)
{
CursorInfo info;
int count;
@@ -366,7 +367,8 @@ gtk_source_vim_visual_begin_command (GtkSourceVimVisual *self,
gtk_source_vim_visual_clear (self);
g_clear_object (&self->command);
- cursor_info_stash (self, &info);
+ if (restore_cursor)
+ cursor_info_stash (self, &info);
self->command = gtk_source_vim_command_new (command);
gtk_source_vim_state_set_count (self->command, count);
@@ -374,11 +376,10 @@ gtk_source_vim_visual_begin_command (GtkSourceVimVisual *self,
gtk_source_vim_state_repeat (self->command);
if (gtk_source_vim_state_get_can_repeat (self->command))
- {
gtk_source_vim_state_set_can_repeat (GTK_SOURCE_VIM_STATE (self), TRUE);
- }
- cursor_info_restore (&info);
+ if (restore_cursor)
+ cursor_info_restore (&info);
gtk_source_vim_state_pop (GTK_SOURCE_VIM_STATE (self));
@@ -470,7 +471,7 @@ key_handler_g (GtkSourceVimVisual *self,
switch (keyval)
{
case GDK_KEY_question:
- return gtk_source_vim_visual_begin_command (self, "rot13");
+ return gtk_source_vim_visual_begin_command (self, "rot13", TRUE);
default:
new_state = gtk_source_vim_motion_new ();
@@ -546,14 +547,14 @@ key_handler_initial (GtkSourceVimVisual *self,
case GDK_KEY_d:
case GDK_KEY_x:
- return gtk_source_vim_visual_begin_command (self, ":delete");
+ return gtk_source_vim_visual_begin_command (self, ":delete", TRUE);
case GDK_KEY_quotedbl:
self->handler = key_handler_register;
return TRUE;
case GDK_KEY_y:
- return gtk_source_vim_visual_begin_command (self, ":yank");
+ return gtk_source_vim_visual_begin_command (self, ":yank", TRUE);
case GDK_KEY_v:
self->mode = GTK_SOURCE_VIM_VISUAL_CHAR;
@@ -568,10 +569,10 @@ key_handler_initial (GtkSourceVimVisual *self,
return TRUE;
case GDK_KEY_U:
- return gtk_source_vim_visual_begin_command (self, "upcase");
+ return gtk_source_vim_visual_begin_command (self, "upcase", TRUE);
case GDK_KEY_u:
- return gtk_source_vim_visual_begin_command (self, "downcase");
+ return gtk_source_vim_visual_begin_command (self, "downcase", TRUE);
case GDK_KEY_g:
self->handler = key_handler_g;
@@ -585,10 +586,10 @@ key_handler_initial (GtkSourceVimVisual *self,
return gtk_source_vim_visual_replace (self);
case GDK_KEY_greater:
- return gtk_source_vim_visual_begin_command (self, "indent");
+ return gtk_source_vim_visual_begin_command (self, "indent", FALSE);
case GDK_KEY_less:
- return gtk_source_vim_visual_begin_command (self, "unindent");
+ return gtk_source_vim_visual_begin_command (self, "unindent", FALSE);
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]