summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-02-15 23:23:55 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-03-16 20:42:18 +0100
commit15587ac72f8cb432e03439e8f5b09754cfab20b3 (patch)
tree8d69270be3629a50eebd2bec6cdab2e55e245532
parent21910b70509685c678e5ac3ff0249382a3b2c494 (diff)
downloadweechat-15587ac72f8cb432e03439e8f5b09754cfab20b3.zip
core: fix function gui_key_legacy_to_alias with keys on areas
-rw-r--r--src/gui/gui-key.c3
-rw-r--r--tests/unit/gui/test-gui-key.cpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index cdd9f4ee5..8cdd79999 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -888,6 +888,9 @@ gui_key_legacy_to_alias (const char *key)
if (!key)
return NULL;
+ if ((key[0] == '@') && strchr (key, ':'))
+ return strdup (key);
+
key_raw = gui_key_get_internal_code (key);
if (!key_raw)
return NULL;
diff --git a/tests/unit/gui/test-gui-key.cpp b/tests/unit/gui/test-gui-key.cpp
index 82f6663c4..07bbe606f 100644
--- a/tests/unit/gui/test-gui-key.cpp
+++ b/tests/unit/gui/test-gui-key.cpp
@@ -830,6 +830,8 @@ TEST(GuiKey, LegacyToAlias)
WEE_TEST_STR(NULL, gui_key_legacy_to_alias (NULL));
WEE_TEST_STR("", gui_key_legacy_to_alias (""));
+ WEE_TEST_STR("@chat:button1", gui_key_legacy_to_alias ("@chat:button1"));
+
WEE_TEST_STR("", gui_key_legacy_to_alias ("ctrl-"));
WEE_TEST_STR("", gui_key_legacy_to_alias ("meta-"));
WEE_TEST_STR("", gui_key_legacy_to_alias ("meta2-"));