diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-02-27 21:55:39 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-03-16 20:42:19 +0100 |
commit | c647d540a702890e8b182b1640fdfa1bd94ced82 (patch) | |
tree | 4e05ba0e2086134d922bdf68f6aa03654940edad | |
parent | d1adec29f9af2ddbc3513a88314b298254417bb5 (diff) | |
download | weechat-c647d540a702890e8b182b1640fdfa1bd94ced82.zip |
core: remove obsolete function gui_key_legacy_expand
-rw-r--r-- | src/gui/gui-key.c | 59 | ||||
-rw-r--r-- | src/gui/gui-key.h | 1 | ||||
-rw-r--r-- | tests/unit/gui/test-gui-key.cpp | 28 |
3 files changed, 0 insertions, 88 deletions
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 6b121912b..60af69e08 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -376,65 +376,6 @@ gui_key_legacy_internal_code (const char *key) } /* - * Gets expanded name from internal key code (legacy function). - * - * Examples: - * "\001j" => "ctrl-j" - * "\001m" => "ctrl-m" - * "\001r" => "ctrl-r" - * "\001[A" => "meta-A" - * "\001[a" => "meta-a" - * "\001[[1;3D" => "meta2-1;3D" - * "\001[w\001[[1;3A" => "meta-wmeta2-1;3A" - * - * Note: result must be freed after use. - */ - -char * -gui_key_legacy_expand (const char *key) -{ - char **result; - - if (!key) - return NULL; - - result = string_dyn_alloc ((strlen (key) * 2) + 1); - if (!result) - return NULL; - - while (key[0]) - { - if (strncmp (key, "\x01[[", 3) == 0) - { - string_dyn_concat (result, "meta2-", -1); - key += 3; - } - if (strncmp (key, "\x01[", 2) == 0) - { - string_dyn_concat (result, "meta-", -1); - key += 2; - } - else if ((key[0] == '\x01') && (key[1])) - { - string_dyn_concat (result, "ctrl-", -1); - key++; - } - else if (key[0] == ' ') - { - string_dyn_concat (result, "space", -1); - key++; - } - else - { - string_dyn_concat (result, key, 1); - key++; - } - } - - return string_dyn_free (result, 0); -} - -/* * Expands raw key code to its name and name using aliases (human readable * key name). * diff --git a/src/gui/gui-key.h b/src/gui/gui-key.h index c28658761..fed8ca750 100644 --- a/src/gui/gui-key.h +++ b/src/gui/gui-key.h @@ -92,7 +92,6 @@ extern void gui_key_init (); extern int gui_key_search_context (const char *context); extern void gui_key_grab_init (int grab_raw_key, int grab_command, const char *delay); -extern char *gui_key_legacy_expand (const char *key); extern int gui_key_expand (const char *key, char **key_name, char **key_name_alias); extern char *gui_key_legacy_to_alias (const char *key); diff --git a/tests/unit/gui/test-gui-key.cpp b/tests/unit/gui/test-gui-key.cpp index 31f6494f3..b99799cd1 100644 --- a/tests/unit/gui/test-gui-key.cpp +++ b/tests/unit/gui/test-gui-key.cpp @@ -148,34 +148,6 @@ TEST(GuiKey, LegacyInternalCode) /* * Tests functions: - * gui_key_legacy_expand - */ - -TEST(GuiKey, ExpandLegacy) -{ - char *str; - - WEE_TEST_STR(NULL, gui_key_legacy_expand (NULL)); - WEE_TEST_STR("", gui_key_legacy_expand ("")); - WEE_TEST_STR("A", gui_key_legacy_expand ("A")); - WEE_TEST_STR("a", gui_key_legacy_expand ("a")); - - WEE_TEST_STR("@chat:t", gui_key_legacy_expand ("@chat:t")); - - WEE_TEST_STR("meta-A", gui_key_legacy_expand ("\001[A")); - WEE_TEST_STR("meta-a", gui_key_legacy_expand ("\001[a")); - - WEE_TEST_STR("meta2-A", gui_key_legacy_expand ("\001[[A")); - WEE_TEST_STR("meta2-a", gui_key_legacy_expand ("\001[[a")); - - WEE_TEST_STR("ctrl-A", gui_key_legacy_expand ("\001A")); - WEE_TEST_STR("ctrl-a", gui_key_legacy_expand ("\001a")); - - WEE_TEST_STR("space", gui_key_legacy_expand (" ")); -} - -/* - * Tests functions: * gui_key_expand */ |