1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

core: remove obsolete function gui_key_legacy_expand

This commit is contained in:
Sébastien Helleu
2023-02-27 21:55:39 +01:00
parent d1adec29f9
commit c647d540a7
3 changed files with 0 additions and 88 deletions
-59
View File
@@ -375,65 +375,6 @@ gui_key_legacy_internal_code (const char *key)
return string_dyn_free (result, 0);
}
/*
* 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).
-1
View File
@@ -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);
-28
View File
@@ -146,34 +146,6 @@ TEST(GuiKey, LegacyInternalCode)
WEE_TEST_STR(" ", gui_key_legacy_internal_code ("space"));
}
/*
* 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