1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

core: remove keys meta-[I and meta-[G for pgup/pgdn (issue #1900)

It seems no terminal return such codes any more for pgup/pgdn, and `meta-[I` is
conflicting with the xterm terminal "focus in" key code.

The keys are also removed from config when converting old keys, but only if
they are bound to the default command (`/window page_up` for `meta2-I` and
`/window page_down` for `meta2-G`).
This commit is contained in:
Sébastien Helleu
2023-03-31 19:00:10 +02:00
parent 867536f8ce
commit 613dc73fd4
3 changed files with 16 additions and 22 deletions
+16 -2
View File
@@ -1519,7 +1519,7 @@ config_weechat_update_cb (const void *pointer, void *data,
int version_read,
struct t_hashtable *data_read)
{
const char *ptr_section, *ptr_option;
const char *ptr_section, *ptr_option, *ptr_value;
char *new_option;
int changes;
@@ -1543,6 +1543,7 @@ config_weechat_update_cb (const void *pointer, void *data,
*/
ptr_section = hashtable_get (data_read, "section");
ptr_option = hashtable_get (data_read, "option");
ptr_value = hashtable_get (data_read, "value");
if (ptr_section
&& ptr_option
&& ((strcmp (ptr_section, "key") == 0)
@@ -1550,8 +1551,21 @@ config_weechat_update_cb (const void *pointer, void *data,
|| (strcmp (ptr_section, "key_cursor") == 0)
|| (strcmp (ptr_section, "key_mouse") == 0)))
{
/*
* remove some obsolete keys:
* - "meta2-200~": start paste
* - "meta2-201~": end paste
* - "meta2-G": page down (only if bound to "/window page_down")
* - "meta2-I": page up (only if bound to "/window page_up")
*/
if ((strcmp (ptr_option, "meta2-200~") == 0)
|| (strcmp (ptr_option, "meta2-201~") == 0))
|| (strcmp (ptr_option, "meta2-201~") == 0)
|| ((strcmp (ptr_option, "meta2-G") == 0)
&& ptr_value
&& (strcmp (ptr_value, "/window page_down") == 0))
|| ((strcmp (ptr_option, "meta2-I") == 0)
&& ptr_value
&& (strcmp (ptr_value, "/window page_up") == 0)))
{
gui_chat_printf (NULL,
_("Legacy key removed: \"%s\""),
-4
View File
@@ -661,12 +661,8 @@ gui_key_expand (const char *key, char **key_name, char **key_name_alias)
}
else if (key[0] == 'F')
snprintf (str_alias, sizeof (str_alias), "end");
else if (key[0] == 'G')
snprintf (str_alias, sizeof (str_alias), "pgdn");
else if (key[0] == 'H')
snprintf (str_alias, sizeof (str_alias), "home");
else if (key[0] == 'I')
snprintf (str_alias, sizeof (str_alias), "pgup");
else if (key[0] == 'P')
snprintf (str_alias, sizeof (str_alias), "f1");
else if (key[0] == 'Q')