diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-12-04 20:03:21 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-12-10 16:05:14 +0100 |
commit | f1cfd6f73f0f5cc16b9b919d64406a35aa81c7cf (patch) | |
tree | 96a6dfbea3772e65aeec1344b2cb4c7061c916ef /doc/en/weechat_plugin_api.en.adoc | |
parent | d18f68e497c4244404ff8f4f50de82717b178e09 (diff) | |
download | weechat-f1cfd6f73f0f5cc16b9b919d64406a35aa81c7cf.zip |
core: do not display non printable chars, fix function utf8_char_size_screen
Now the function utf8_char_size_screen can return -1 when the char is not
printable.
It has a specific behavior for some chars:
- U+0009: value of option weechat.look.tab_width
- U+0001 to U+001F (except U+0009): 1
- U+00AD (soft hyphen): -1
- U+200B (zero width space): -1
Diffstat (limited to 'doc/en/weechat_plugin_api.en.adoc')
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 3a2c5cba3..ecd867599 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -894,11 +894,12 @@ This function is not available in scripting API. ==== strlen_screen -_WeeChat ≥ 0.4.2._ +_WeeChat ≥ 0.4.2, updated in 3.8._ Return number of chars needed on screen to display UTF-8 string. -Non-printable chars have a width of 1 (this is the difference with the function -<<_utf8_strlen_screen,utf8_strlen_screen>>). + +WeeChat color codes are skipped and don't count in the result (this is the only +difference with the function <<_utf8_strlen_screen,utf8_strlen_screen>>). Prototype: @@ -3639,6 +3640,8 @@ This function is not available in scripting API. ==== utf8_char_size_screen +_Updated in 3.8._ + Return number of chars needed on screen to display UTF-8 char. Prototype: @@ -3654,7 +3657,18 @@ Arguments: Return value: -* number of chars needed on screen to display UTF-8 char +* number of chars needed on screen to display UTF-8 char: +** -1: non printable char +** ≥ 0: printable char + +The result is the return value of function `wcwidth` (see `man wcwidth`), with +exception for the following chars, that have a specific behavior in WeeChat: + +* U+0009 (Tabulation): value of option + link:weechat_user.en.html#option_weechat.look.tab_width[weechat.look.tab_width ^↗^,window=_blank] +* U+0001 (1) to U+001F (31), except U+0009 (Tabulation): 1 +* U+00AD (173, soft hyphen): -1 +* U+200B (8203, zero width space): -1 C example: |