From 9e7031f5d81bd5464f9972c0b801cf1dbcdf0a3a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Feb 2021 13:36:38 +0530 Subject: [PATCH] Dont call window_for_id() unnecessarily --- kitty/keys.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kitty/keys.c b/kitty/keys.c index 6ae3d9ad4..30d01cbf9 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -155,13 +155,13 @@ on_key_input(GLFWkeyevent *ev) { if (action == GLFW_PRESS || action == GLFW_REPEAT) { create_key_event(); + w->last_special_key_pressed = 0; PyObject *ret = PyObject_CallMethod(global_state.boss, "dispatch_possible_special_key", "O", ke); Py_CLEAR(ke); bool consumed = false; - // the shortcut could have created a new window or closed the window, rendering the pointer - // no longer valid + // the shortcut could have created a new window or closed the + // window, rendering the pointer no longer valid w = window_for_id(active_window_id); - if (w) w->last_special_key_pressed = 0; if (ret == NULL) { PyErr_Print(); } else { consumed = ret == Py_True;