From dee7313fcc2d24c5f2a7fff8dadac0a4700c08cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 15 Jan 2022 09:36:02 +0100 Subject: trigger: fix search of triggers with UTF-8 chars in name (issue #1739) --- src/plugins/trigger/trigger.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/trigger/trigger.c') diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 4e88a2978..5f99dbcc0 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -207,6 +207,7 @@ trigger_search_with_option (struct t_config_option *option) const char *ptr_name; char *pos_option; struct t_trigger *ptr_trigger; + int num_chars; if (!option) return NULL; @@ -220,10 +221,12 @@ trigger_search_with_option (struct t_config_option *option) if (!pos_option) return NULL; + num_chars = weechat_utf8_pos (ptr_name, pos_option - ptr_name); + for (ptr_trigger = triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) { - if (weechat_strncasecmp (ptr_trigger->name, ptr_name, pos_option - ptr_name) == 0) + if (weechat_strncasecmp (ptr_trigger->name, ptr_name, num_chars) == 0) break; } -- cgit v1.2.3