[gtksourceview] vim: allow applications to handle gd/gD
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: allow applications to handle gd/gD
- Date: Thu, 22 Sep 2022 05:55:20 +0000 (UTC)
commit 342caac709d25abd0fefde264f1dae7f96248652
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 21 22:54:58 2022 -0700
vim: allow applications to handle gd/gD
gtksourceview/vim/gtksourcevimnormal.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gtksourceview/vim/gtksourcevimnormal.c b/gtksourceview/vim/gtksourcevimnormal.c
index 54cd61f3..5f85052d 100644
--- a/gtksourceview/vim/gtksourcevimnormal.c
+++ b/gtksourceview/vim/gtksourcevimnormal.c
@@ -1048,6 +1048,7 @@ key_handler_g (GtkSourceVimNormal *self,
const char *string)
{
GtkSourceVimState *new_state;
+ GtkSourceVimState *root;
g_assert (GTK_SOURCE_IS_VIM_NORMAL (self));
@@ -1077,6 +1078,19 @@ key_handler_g (GtkSourceVimNormal *self,
gtk_source_vim_state_push (GTK_SOURCE_VIM_STATE (self), new_state);
return TRUE;
+ case GDK_KEY_d:
+ case GDK_KEY_D:
+ if ((root = gtk_source_vim_state_get_root (GTK_SOURCE_VIM_STATE (self))) &&
+ GTK_SOURCE_IS_VIM (root))
+ {
+ const char *command = keyval == GDK_KEY_d ? "gd" : "gD";
+ gtk_source_vim_emit_execute_command (GTK_SOURCE_VIM (root), command);
+ gtk_source_vim_normal_clear (self);
+ return TRUE;
+ }
+
+ G_GNUC_FALLTHROUGH;
+
default:
return gtk_source_vim_normal_bail (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]