[gtksourceview/wip/chergert/vim: 206/363] allow setting register in visual mode




commit 84a49feccc59cdb07918df3d4768b24144278f04
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 13:19:35 2021 -0700

    allow setting register in visual mode

 gtksourceview/vim/gtk-source-vim-visual.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-visual.c b/gtksourceview/vim/gtk-source-vim-visual.c
index 5d5b445d..37747039 100644
--- a/gtksourceview/vim/gtk-source-vim-visual.c
+++ b/gtksourceview/vim/gtk-source-vim-visual.c
@@ -252,6 +252,25 @@ key_handler_z (GtkSourceVimVisual *self,
        }
 }
 
+static gboolean
+key_handler_register (GtkSourceVimVisual *self,
+                     guint               keyval,
+                     guint               keycode,
+                     GdkModifierType     mods,
+                     const char         *string)
+{
+       g_assert (GTK_SOURCE_IS_VIM_VISUAL (self));
+
+       if (string == NULL || string[0] == 0)
+               return gtk_source_vim_visual_bail (self);
+
+       gtk_source_vim_state_set_current_register (GTK_SOURCE_VIM_STATE (self), string);
+
+       self->handler = key_handler_initial;
+
+       return TRUE;
+}
+
 static void
 gtk_source_vim_visual_delete (GtkSourceVimVisual *self)
 {
@@ -290,6 +309,10 @@ key_handler_initial (GtkSourceVimVisual *self,
                        gtk_source_vim_visual_delete (self);
                        return TRUE;
 
+               case GDK_KEY_quotedbl:
+                       self->handler = key_handler_register;
+                       return TRUE;
+
                default:
                        break;
        }


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