diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/core/wee-string.c | 2 | ||||
-rw-r--r-- | tests/unit/core/test-eval.cpp | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index a969cdaeb..37fc5f8a9 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -36,6 +36,7 @@ New features:: Bug fixes:: + * core: count number of chars instead of bytes for suffix in function string_cut * core: fix delete of previous/next word (keys kbd:[Ctrl+w] and kbd:[Alt+d]) (issue #1195) * core: fix infinite loop in evaluation of strings (issue #1183) * core: change default value of option weechat.look.window_title from "WeeChat ${info:version}" to empty string (issue #1182) diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 4a2955396..f1231bb6b 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -134,7 +134,7 @@ string_cut (const char *string, int length, int count_suffix, int screen, if (screen) length -= utf8_strlen_screen (cut_suffix); else - length -= length_cut_suffix; + length -= utf8_strlen (cut_suffix); if (length < 0) return strdup (""); if (screen) diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp index 5d5d0f3ec..c24248495 100644 --- a/tests/unit/core/test-eval.cpp +++ b/tests/unit/core/test-eval.cpp @@ -296,7 +296,7 @@ TEST(Eval, EvalExpression) WEE_CHECK_EVAL("tes…", "${cutscr:3,…,test}"); WEE_CHECK_EVAL("te+", "${cut:+3,+,test}"); WEE_CHECK_EVAL("te+", "${cutscr:+3,+,test}"); - WEE_CHECK_EVAL("…", "${cut:+3,…,test}"); + WEE_CHECK_EVAL("te…", "${cut:+3,…,test}"); WEE_CHECK_EVAL("te…", "${cutscr:+3,…,test}"); WEE_CHECK_EVAL("t++", "${cut:+3,++,test}"); WEE_CHECK_EVAL("t++", "${cutscr:+3,++,test}"); |