[gtksourceview/wip/chergert/vim: 352/363] allow setting mark by alpha char
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 352/363] allow setting mark by alpha char
- Date: Mon, 8 Nov 2021 19:53:56 +0000 (UTC)
commit 66fa502f71abbd35d81ef11274ad1a0bc8be943b
Author: Christian Hergert <chergert redhat com>
Date: Sun Nov 7 11:11:28 2021 -0800
allow setting mark by alpha char
gtksourceview/vim/gtk-source-vim-normal.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index 2172c40b..7455121a 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -1023,6 +1023,27 @@ key_handler_motion (GtkSourceVimNormal *self,
return TRUE;
}
+static gboolean
+key_handler_mark (GtkSourceVimNormal *self,
+ guint keyval,
+ guint keycode,
+ GdkModifierType mods,
+ const char *string)
+{
+ GtkTextIter iter;
+
+ if (!g_ascii_isalpha (string[0]))
+ {
+ return gtk_source_vim_normal_bail (self);
+ }
+
+ gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, NULL);
+ gtk_source_vim_state_set_mark (GTK_SOURCE_VIM_STATE (self), string, &iter);
+ gtk_source_vim_normal_clear (self);
+
+ return TRUE;
+}
+
static gboolean
key_handler_initial (GtkSourceVimNormal *self,
guint keyval,
@@ -1116,6 +1137,10 @@ key_handler_initial (GtkSourceVimNormal *self,
self->handler = key_handler_motion;
break;
+ case GDK_KEY_m:
+ self->handler = key_handler_mark;
+ return TRUE;
+
case GDK_KEY_1: case GDK_KEY_KP_1:
case GDK_KEY_2: case GDK_KEY_KP_2:
case GDK_KEY_3: case GDK_KEY_KP_3:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]