[gtksourceview] vim: allow shortcuts to pass through from Normal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: allow shortcuts to pass through from Normal
- Date: Tue, 7 Dec 2021 06:16:24 +0000 (UTC)
commit 60c26c1fe7a949d2f9910279724065dca005ff20
Author: Christian Hergert <chergert redhat com>
Date: Mon Dec 6 22:14:11 2021 -0800
vim: allow shortcuts to pass through from Normal
We want shortcuts to pass-through instead of being swallowed. However,
there isn't really a way to know for sure what will end up being a
shortcut and we can't test the GtkShortcutControllers up the hierarchy
because handle_event() is private API.
So instead just cheat and check for control/alt/super masks and empty
strings to determine if it's something relatively safe to pass along.
gtksourceview/vim/gtksourcevimnormal.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gtksourceview/vim/gtksourcevimnormal.c b/gtksourceview/vim/gtksourcevimnormal.c
index 3ccd26b4..8d2ab835 100644
--- a/gtksourceview/vim/gtksourcevimnormal.c
+++ b/gtksourceview/vim/gtksourcevimnormal.c
@@ -1304,7 +1304,20 @@ key_handler_initial (GtkSourceVimNormal *self,
}
if (self->handler == key_handler_initial)
+ {
+ /* If this is possibly a shortcut (alt, control, etc) then we
+ * can let it pass through without being too likely to activate
+ * text insertion. Additionally, if there is no @string value
+ * then there isn't anything likely to be passed on to the
+ * textview to insert but it might be something like F10.
+ */
+ if ((mods & (GDK_CONTROL_MASK | GDK_SUPER_MASK | GDK_ALT_MASK)) != 0 || string[0] == 0)
+ {
+ return FALSE;
+ }
+
return gtk_source_vim_normal_bail (self);
+ }
return self->handler (self, keyval, keycode, mods, string);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]