[Github-comments] [geany/geany-plugins] vimode: A Vim Mode for Geany (#735)

pcworld notifications at xxxxx
Sat Apr 21 02:48:28 UTC 2018


pcworld commented on this pull request.



> + * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "keypress.h"
+#include "utils.h"
+
+#include <gdk/gdkkeysyms.h>
+
+KeyPress *kp_from_event_key(GdkEventKey *ev)
+{
+	guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_CONTROL_MASK);
+	KeyPress *kp;
+
+	if (ev->state & mask)
+		return NULL;

I found the cause of my issue with vimode not recognizing keypresses. I have num lock enabled, which maps to [`GDK_MOD2_MASK`](https://github.com/GNOME/gtk/blob/cfa04805a327300056b7cfb5b3c127e667b8f4c3/gdk/gdktypes.h#L230) in GDK in X11 (in my configuration at least). The following patch fixes it for me, however an even less restrictive mask might be appropriate in order to avoid further false positives:

```diff
--- a/vimode/src/keypress.c
+++ b/vimode/src/keypress.c
@@ -23,7 +23,7 @@
 
 KeyPress *kp_from_event_key(GdkEventKey *ev)
 {
-       guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_CONTROL_MASK);
+       guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_CONTROL_MASK | GDK_MOD2_MASK);
        KeyPress *kp;
 
        if (ev->state & mask)
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/735#pullrequestreview-114160590
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20180421/734e6d49/attachment.html>


More information about the Github-comments mailing list