From bcc061292de14c522c07af5a72d37e775528c50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 4 Jul 2023 19:10:04 +0200 Subject: [PATCH] core: keep keys ctrl-H and ctrl-? (in lower case) if they were manually bound to custom commands in a previous version --- ChangeLog.adoc | 1 + src/core/wee-config.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 768b6d957..89f41e168 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -18,6 +18,7 @@ Bug fixes:: * core: don't send "key_pressed" signal again for the same key press (issue #1976) * core: don't send "key_combo_*" signals for incomplete keys (issue #1976) * core: add key ctrl-backspace in /help key (issue #1975) + * core: keep keys ctrl-H and ctrl-? (in lower case) if they were manually bound to custom commands in a previous version Tests:: diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 7da423fa5..2d15577e0 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -1601,7 +1601,23 @@ config_weechat_update_cb (const void *pointer, void *data, } else { - new_option = gui_key_legacy_to_alias (ptr_option); + /* + * if backspace or ctrl-backspace was manually bound to a + * different command, keep the key as-is (in lower case) ; + * in all other cases, convert the key to the new name + */ + if (ptr_section + && (strcmp (ptr_section, "key") == 0) + && ((strcmp (ptr_option, "ctrl-H") == 0) + || (strcmp (ptr_option, "ctrl-?") == 0)) + && (strcmp (ptr_value, "/input delete_previous_char") != 0)) + { + new_option = string_tolower (ptr_option); + } + else + { + new_option = gui_key_legacy_to_alias (ptr_option); + } if (new_option) { if (strcmp (ptr_option, new_option) != 0)