summaryrefslogtreecommitdiff
path: root/src/plugins/trigger/trigger.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-01-15 09:36:02 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-01-15 09:36:02 +0100
commitdee7313fcc2d24c5f2a7fff8dadac0a4700c08cd (patch)
tree4948f1ac1772096c41a5e6752db52e8be17489e8 /src/plugins/trigger/trigger.c
parent305608ce895ab4ba697359c0fba3883d8a630d51 (diff)
downloadweechat-dee7313fcc2d24c5f2a7fff8dadac0a4700c08cd.zip
trigger: fix search of triggers with UTF-8 chars in name (issue #1739)
Diffstat (limited to 'src/plugins/trigger/trigger.c')
-rw-r--r--src/plugins/trigger/trigger.c5
1 files changed, 4 insertions, 1 deletions
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;
}