summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-03-31 19:00:10 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-03-31 18:57:58 +0200
commit613dc73fd4f60d96d62bab050eff05dcfdd5c75d (patch)
tree839ea068e424dd6575638578bf89b00e4ee3a5fd /src
parent867536f8ced45823b64b7ede6dca949fefb9cc43 (diff)
downloadweechat-613dc73fd4f60d96d62bab050eff05dcfdd5c75d.zip
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`).
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c18
-rw-r--r--src/gui/gui-key.c4
2 files changed, 16 insertions, 6 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 7bfd364f5..d1ca0addf 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -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\""),
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index 2fa221285..7f7efc143 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -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')