core: count number of chars instead of bytes for suffix in function string_cut

v2.8-utf8proc
Sébastien Helleu 2018-06-02 15:17:59 +02:00
parent 39a291bc53
commit ba19fa9963
3 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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}");