From 5ccbdca0c9fde1186a1fd5653d6391db55254cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 4 Apr 2025 18:52:58 +0200 Subject: [PATCH] core: consider all keys are safe in cursor context (closes #2244) --- CHANGELOG.md | 1 + src/gui/gui-key.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d86500b..b828769f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- core: consider all keys are safe in cursor context ([#2244](https://github.com/weechat/weechat/issues/2244)) - irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled ([#2241](https://github.com/weechat/weechat/issues/2241)) - perl: fix build when multiplicity is not available ([#2243](https://github.com/weechat/weechat/issues/2243)) diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 3be4857ff..3a68f09d2 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1215,12 +1215,12 @@ gui_key_set_score (struct t_gui_key *key) } /* - * Checks if a key is safe or not: a safe key begins always with the "meta" or - * "ctrl" code (except "@" allowed in cursor/mouse contexts). + * Checks if a key is safe or not: a safe key should begin with the "meta" or + * "ctrl" code (there are exceptions). * * Returns: - * 1: key is safe - * 0: key is NOT safe + * 1: key is safe for the given context + * 0: key is NOT safe for the given context */ int @@ -1231,13 +1231,13 @@ gui_key_is_safe (int context, const char *key) if (!key || !key[0]) return 0; - /* "@" is allowed at beginning for cursor/mouse contexts */ - if ((key[0] == '@') - && ((context == GUI_KEY_CONTEXT_CURSOR) - || (context == GUI_KEY_CONTEXT_MOUSE))) - { + /* all keys are safe in cursor mode */ + if (context == GUI_KEY_CONTEXT_CURSOR) + return 1; + + /* "@" is allowed at beginning for mouse context */ + if ((key[0] == '@') && (context == GUI_KEY_CONTEXT_MOUSE)) return 1; - } if (strncmp (key, "comma", 5) == 0) return 0;