From 5dba9fd0cc1839f13a0859420fcc9373f9b7a276 Mon Sep 17 00:00:00 2001 From: vague666 Date: Sun, 9 Feb 2020 12:40:09 +0100 Subject: [PATCH 1/3] Search for word anywhere, not only from the beginning of string --- src/fe-common/core/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 8f90b1ad..986ee7bd 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -772,7 +772,7 @@ static void cmd_show_keys(const char *searchkey, int full) if ((len == 0 || (full ? strncmp(rec->key, searchkey, len) == 0 : - g_ascii_strncasecmp(rec->key, searchkey, len) == 0)) && + g_strrstr(rec->key, searchkey) != NULL)) && (!full || rec->key[len] == '\0')) { printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_LIST, rec->key, rec->info->id, rec->data == NULL ? "" : rec->data); From fe9a44338087b186deeb11d57c520d2be44c383b Mon Sep 17 00:00:00 2001 From: vague666 Date: Mon, 29 Jun 2020 16:11:45 +0200 Subject: [PATCH 2/3] change to strstr --- src/fe-common/core/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 986ee7bd..fa8ca076 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -772,7 +772,7 @@ static void cmd_show_keys(const char *searchkey, int full) if ((len == 0 || (full ? strncmp(rec->key, searchkey, len) == 0 : - g_strrstr(rec->key, searchkey) != NULL)) && + strstr(rec->key, searchkey) != NULL)) && (!full || rec->key[len] == '\0')) { printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_LIST, rec->key, rec->info->id, rec->data == NULL ? "" : rec->data); From 0d2997b36f76798472d717ffb1fdee95b3561507 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 30 Jun 2020 09:29:50 +0200 Subject: [PATCH 3/3] make clang-format happy in keyboard.c --- src/fe-common/core/keyboard.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index fa8ca076..e0e061dd 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -770,9 +770,8 @@ static void cmd_show_keys(const char *searchkey, int full) for (key = rec->keys; key != NULL; key = key->next) { KEY_REC *rec = key->data; - if ((len == 0 || - (full ? strncmp(rec->key, searchkey, len) == 0 : - strstr(rec->key, searchkey) != NULL)) && + if ((len == 0 || (full ? strncmp(rec->key, searchkey, len) == 0 : + strstr(rec->key, searchkey) != NULL)) && (!full || rec->key[len] == '\0')) { printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_LIST, rec->key, rec->info->id, rec->data == NULL ? "" : rec->data);