1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

core: add a way to count the suffix length in max chars displayed in cut of string ("cut:" and "cutscr:") (closes #963)

The format to use is one of:

- ${cut:+max,suffix,string}
- ${cutscr:+max,suffix,string}

With the "+" before max, WeeChat ensures there are at most "max" chars in
output, including the length of suffix string.
This commit is contained in:
Sébastien Helleu
2017-04-24 22:37:49 +02:00
parent 0470a71af9
commit 112bebcddf
28 changed files with 331 additions and 195 deletions
+6 -3
View File
@@ -7269,9 +7269,11 @@ command_init ()
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" "
"or \"cut:+max,suffix,string\")\n"
" or max chars displayed on screen "
"(format: \"cutscr:max,suffix,string\")\n"
"(format: \"cutscr:max,suffix,string\" or "
"\"cutscr:+max,suffix,string\")\n"
" 5. a color (format: \"color:xxx\", see \"Plugin API "
"reference\", function \"color\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are "
@@ -7311,7 +7313,8 @@ command_init ()
" /eval -n ${window.buffer.number} ==> 1\n"
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:3,+,test} ==> tes+\n"
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"