[gtksourceview/wip/chergert/vim: 278/293] implement >> and << in normal mode




commit 82b0429c5da925d945cf8001520279827ab2ad21
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 3 17:01:37 2021 -0700

    implement >> and << in normal mode

 gtksourceview/vim/gtk-source-vim-normal.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index 696b1f2a..4c64d281 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -698,7 +698,19 @@ key_handler_shift (GtkSourceVimNormal *self,
 {
        g_assert (GTK_SOURCE_IS_VIM_NORMAL (self));
 
-       return TRUE;
+       switch (keyval)
+       {
+               case GDK_KEY_greater:
+                       gtk_source_vim_normal_begin_command (self, NULL, NULL, "indent", 0);
+                       return TRUE;
+
+               case GDK_KEY_less:
+                       gtk_source_vim_normal_begin_command (self, NULL, NULL, "unindent", 0);
+                       return TRUE;
+
+               default:
+                       return gtk_source_vim_normal_bail (self);
+       }
 }
 
 static gboolean
@@ -991,7 +1003,7 @@ key_handler_initial (GtkSourceVimNormal *self,
                        case GDK_KEY_greater:
                        case GDK_KEY_less:
                                self->handler = key_handler_shift;
-                               break;
+                               return TRUE;
 
                        case GDK_KEY_r:
                                return gtk_source_vim_normal_replace_one (self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]