summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc3
-rw-r--r--doc/de/autogen/user/weechat_commands.adoc20
-rw-r--r--doc/en/autogen/user/weechat_commands.adoc20
-rw-r--r--doc/en/weechat_plugin_api.en.adoc16
-rw-r--r--doc/fr/autogen/user/weechat_commands.adoc20
-rw-r--r--doc/fr/weechat_plugin_api.fr.adoc16
-rw-r--r--doc/it/autogen/user/weechat_commands.adoc20
-rw-r--r--doc/it/weechat_plugin_api.it.adoc17
-rw-r--r--doc/ja/autogen/user/weechat_commands.adoc20
-rw-r--r--doc/ja/weechat_plugin_api.ja.adoc18
-rw-r--r--doc/pl/autogen/user/weechat_commands.adoc20
-rw-r--r--po/cs.po22
-rw-r--r--po/de.po23
-rw-r--r--po/es.po22
-rw-r--r--po/fr.po44
-rw-r--r--po/hu.po22
-rw-r--r--po/it.po22
-rw-r--r--po/ja.po22
-rw-r--r--po/pl.po22
-rw-r--r--po/pt.po22
-rw-r--r--po/pt_BR.po22
-rw-r--r--po/ru.po22
-rw-r--r--po/tr.po22
-rw-r--r--po/weechat.pot22
-rw-r--r--src/core/wee-command.c21
-rw-r--r--src/core/wee-eval.c60
-rw-r--r--tests/unit/core/test-core-eval.cpp9
27 files changed, 364 insertions, 225 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 7fdad04a1..52197b1b0 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -20,7 +20,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
- * core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997)
+ * core: add length of string (number of chars and on screen) in evaluation of expressions with "length:xxx" and "lengthscr:xxx"
+ * core: add calculation of expression in evaluation of expressions with "calc:xxx" (issue #997)
* script: add options "-ol" and "-il" in command /script to send translated string with list of scripts loaded, display "No scripts loaded" if no scripts are loaded
Bug fixes::
diff --git a/doc/de/autogen/user/weechat_commands.adoc b/doc/de/autogen/user/weechat_commands.adoc
index a4f3ec153..d471d782b 100644
--- a/doc/de/autogen/user/weechat_commands.adoc
+++ b/doc/de/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Some variables are replaced in expression, using the format ${variable}, variabl
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
- 7. a color (format: "color:xxx", see "Plugin API reference", function "color")
- 8. an info (format: "info:name,arguments", arguments are optional)
- 9. current date/time (format: "date" or "date:format")
- 10. an environment variable (format: "env:XXX")
- 11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
- 12. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
- 13. an option (format: "file.section.option")
- 14. a local variable in buffer
- 15. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
+ 7. length of a string (format: "length:xxx" or "lengthscr:xxx")
+ 8. a color (format: "color:xxx", see "Plugin API reference", function "color")
+ 9. an info (format: "info:name,arguments", arguments are optional)
+ 10. current date/time (format: "date" or "date:format")
+ 11. an environment variable (format: "env:XXX")
+ 12. a ternary operator (format: "if:condition?value_if_true:value_if_false")
+ 13. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
+ 14. an option (format: "file.section.option")
+ 15. a local variable in buffer
+ 16. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@@ -338,6 +339,7 @@ Examples (simple strings):
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Examples (conditions):
diff --git a/doc/en/autogen/user/weechat_commands.adoc b/doc/en/autogen/user/weechat_commands.adoc
index 2cf3cf4c1..4acf24692 100644
--- a/doc/en/autogen/user/weechat_commands.adoc
+++ b/doc/en/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Some variables are replaced in expression, using the format ${variable}, variabl
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
- 7. a color (format: "color:xxx", see "Plugin API reference", function "color")
- 8. an info (format: "info:name,arguments", arguments are optional)
- 9. current date/time (format: "date" or "date:format")
- 10. an environment variable (format: "env:XXX")
- 11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
- 12. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
- 13. an option (format: "file.section.option")
- 14. a local variable in buffer
- 15. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
+ 7. length of a string (format: "length:xxx" or "lengthscr:xxx")
+ 8. a color (format: "color:xxx", see "Plugin API reference", function "color")
+ 9. an info (format: "info:name,arguments", arguments are optional)
+ 10. current date/time (format: "date" or "date:format")
+ 11. an environment variable (format: "env:XXX")
+ 12. a ternary operator (format: "if:condition?value_if_true:value_if_false")
+ 13. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
+ 14. an option (format: "file.section.option")
+ 15. a local variable in buffer
+ 16. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@@ -338,6 +339,7 @@ Examples (simple strings):
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Examples (conditions):
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index 3a16f07c8..91a7e14f3 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -2474,6 +2474,22 @@ expanded to last):
`+${repeat:5,-}+` |
`+-----+`
+| `+${length:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string (number of UTF-8 chars). |
+ `+${length:test}+` +
+ `+${length:こんにちは世界}+` |
+ `+4+` +
+ `+7+`
+
+| `+${lengthscr:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string displayed on screen. |
+ `+${lengthscr:test}+` +
+ `+${lengthscr:こんにちは世界}+` |
+ `+4+` +
+ `+14+`
+
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Regex captured group: `0` = whole string matching, `1` to `99` = group
diff --git a/doc/fr/autogen/user/weechat_commands.adoc b/doc/fr/autogen/user/weechat_commands.adoc
index 11b23825a..e2e966d85 100644
--- a/doc/fr/autogen/user/weechat_commands.adoc
+++ b/doc/fr/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Des variables sont remplacées dans l'expression, en utilisant le format ${varia
ou un maximum de caractères affichés à l'écran (format : "cutscr:max,suffixe,chaîne" ou "cutscr:+max,suffixe,chaîne")
5. une chaîne inversée (format : "rev:xxx")
6. une chaîne répétée (format : "repeat:nombre,chaîne")
- 7. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
- 8. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
- 9. la date/heure courante (format : "date" ou "date:format")
- 10. une variable d'environnement (format : "env:XXX")
- 11. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
- 12. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % (format: "calc:xxx")
- 13. une option (format : "fichier.section.option")
- 14. une variable locale du tampon
- 15. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants.
+ 7. longueur d'une chaîne (format : "length:xxx" ou "lengthscr:xxx")
+ 8. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
+ 9. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
+ 10. la date/heure courante (format : "date" ou "date:format")
+ 11. une variable d'environnement (format : "env:XXX")
+ 12. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
+ 13. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % (format: "calc:xxx")
+ 14. une option (format : "fichier.section.option")
+ 15. une variable locale du tampon
+ 16. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants.
Le format du hdata peut être le suivant :
hdata.var1.var2... : démarrer avec un hdata (le pointeur doit être connu), et demander les variables l'une après l'autre (d'autres hdata peuvent être suivis)
hdata[liste].var1.var2... : démarrer avec un hdata en utilisant une liste, par exemple :
@@ -338,6 +339,7 @@ Exemples (chaînes simples) :
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Exemples (conditions) :
diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc
index 9ee096314..1ea4042a4 100644
--- a/doc/fr/weechat_plugin_api.fr.adoc
+++ b/doc/fr/weechat_plugin_api.fr.adoc
@@ -2521,6 +2521,22 @@ première étendue à la dernière) :
`+${repeat:5,-}+` |
`+-----+`
+| `+${length:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Longueur de la chaîne (nombre de caractères UTF-8). |
+ `+${length:test}+` +
+ `+${length:こんにちは世界}+` |
+ `+4+` +
+ `+7+`
+
+| `+${lengthscr:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Longueur de la chaîne affichée à l'écran. |
+ `+${lengthscr:test}+` +
+ `+${lengthscr:こんにちは世界}+` |
+ `+4+` +
+ `+14+`
+
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Groupe regex capturé : `0` = toute la chaîne correspondante,
diff --git a/doc/it/autogen/user/weechat_commands.adoc b/doc/it/autogen/user/weechat_commands.adoc
index ee8b89271..e2b6961e8 100644
--- a/doc/it/autogen/user/weechat_commands.adoc
+++ b/doc/it/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Some variables are replaced in expression, using the format ${variable}, variabl
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
- 7. a color (format: "color:xxx", see "Plugin API reference", function "color")
- 8. an info (format: "info:name,arguments", arguments are optional)
- 9. current date/time (format: "date" or "date:format")
- 10. an environment variable (format: "env:XXX")
- 11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
- 12. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
- 13. an option (format: "file.section.option")
- 14. a local variable in buffer
- 15. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
+ 7. length of a string (format: "length:xxx" or "lengthscr:xxx")
+ 8. a color (format: "color:xxx", see "Plugin API reference", function "color")
+ 9. an info (format: "info:name,arguments", arguments are optional)
+ 10. current date/time (format: "date" or "date:format")
+ 11. an environment variable (format: "env:XXX")
+ 12. a ternary operator (format: "if:condition?value_if_true:value_if_false")
+ 13. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
+ 14. an option (format: "file.section.option")
+ 15. a local variable in buffer
+ 16. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@@ -338,6 +339,7 @@ Examples (simple strings):
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Examples (conditions):
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc
index 1b547fa40..72b139616 100644
--- a/doc/it/weechat_plugin_api.it.adoc
+++ b/doc/it/weechat_plugin_api.it.adoc
@@ -2582,6 +2582,22 @@ expanded to last):
`+${repeat:5,-}+` |
`+-----+`
+| `+${length:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string (number of UTF-8 chars). |
+ `+${length:test}+` +
+ `+${length:こんにちは世界}+` |
+ `+4+` +
+ `+7+`
+
+| `+${lengthscr:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string displayed on screen. |
+ `+${lengthscr:test}+` +
+ `+${lengthscr:こんにちは世界}+` |
+ `+4+` +
+ `+14+`
+
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Regex captured group: `0` = whole string matching, `1` to `99` = group
@@ -2642,7 +2658,6 @@ expanded to last):
`+${if:${info:term_width}>80?big:small}+` |
`+big+`
-// TRANSLATION MISSING
| `+${calc:xxx}+` +
(_WeeChat ≥ 2.7_) |
Result of expression, where parentheses and the following operators are
diff --git a/doc/ja/autogen/user/weechat_commands.adoc b/doc/ja/autogen/user/weechat_commands.adoc
index e1bce21d2..4ff1a42b4 100644
--- a/doc/ja/autogen/user/weechat_commands.adoc
+++ b/doc/ja/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Some variables are replaced in expression, using the format ${variable}, variabl
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
- 7. a color (format: "color:xxx", see "Plugin API reference", function "color")
- 8. an info (format: "info:name,arguments", arguments are optional)
- 9. current date/time (format: "date" or "date:format")
- 10. an environment variable (format: "env:XXX")
- 11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
- 12. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
- 13. an option (format: "file.section.option")
- 14. a local variable in buffer
- 15. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
+ 7. length of a string (format: "length:xxx" or "lengthscr:xxx")
+ 8. a color (format: "color:xxx", see "Plugin API reference", function "color")
+ 9. an info (format: "info:name,arguments", arguments are optional)
+ 10. current date/time (format: "date" or "date:format")
+ 11. an environment variable (format: "env:XXX")
+ 12. a ternary operator (format: "if:condition?value_if_true:value_if_false")
+ 13. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
+ 14. an option (format: "file.section.option")
+ 15. a local variable in buffer
+ 16. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@@ -338,6 +339,7 @@ Examples (simple strings):
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Examples (conditions):
diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc
index d26562c93..b65b7fc93 100644
--- a/doc/ja/weechat_plugin_api.ja.adoc
+++ b/doc/ja/weechat_plugin_api.ja.adoc
@@ -2485,6 +2485,24 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
`+${repeat:5,-}+` |
`+-----+`
+// TRANSLATION MISSING
+| `+${length:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string (number of UTF-8 chars). |
+ `+${length:test}+` +
+ `+${length:こんにちは世界}+` |
+ `+4+` +
+ `+7+`
+
+// TRANSLATION MISSING
+| `+${lengthscr:xxx}+` +
+ (_WeeChat ≥ 2.7_) |
+ Length of string displayed on screen. |
+ `+${lengthscr:test}+` +
+ `+${lengthscr:こんにちは世界}+` |
+ `+4+` +
+ `+14+`
+
| `+${re:N}+` +
(_WeeChat バージョン 1.1 以上で利用可_) |
正規表現のキャプチャグループ: `0` = マッチするすべての文字列、`1` から `99` =
diff --git a/doc/pl/autogen/user/weechat_commands.adoc b/doc/pl/autogen/user/weechat_commands.adoc
index d1dc22327..cd8c3aa64 100644
--- a/doc/pl/autogen/user/weechat_commands.adoc
+++ b/doc/pl/autogen/user/weechat_commands.adoc
@@ -303,15 +303,16 @@ Some variables are replaced in expression, using the format ${variable}, variabl
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
- 7. a color (format: "color:xxx", see "Plugin API reference", function "color")
- 8. an info (format: "info:name,arguments", arguments are optional)
- 9. current date/time (format: "date" or "date:format")
- 10. an environment variable (format: "env:XXX")
- 11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
- 12. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
- 13. an option (format: "file.section.option")
- 14. a local variable in buffer
- 15. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
+ 7. length of a string (format: "length:xxx" or "lengthscr:xxx")
+ 8. a color (format: "color:xxx", see "Plugin API reference", function "color")
+ 9. an info (format: "info:name,arguments", arguments are optional)
+ 10. current date/time (format: "date" or "date:format")
+ 11. an environment variable (format: "env:XXX")
+ 12. a ternary operator (format: "if:condition?value_if_true:value_if_false")
+ 13. result of an expression with parentheses and operators + - * / // % (format: "calc:xxx")
+ 14. an option (format: "file.section.option")
+ 15. a local variable in buffer
+ 16. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@@ -338,6 +339,7 @@ Examples (simple strings):
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
+ /eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
Examples (conditions):
diff --git a/po/cs.po b/po/cs.po
index 6375c9f9a..df81d3dd3 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1572,18 +1572,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1618,6 +1619,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/de.po b/po/de.po
index 3741fd56b..c7360e224 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-09-20 23:09+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -1661,6 +1661,7 @@ msgstr "evaluierter Ausdruck"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
+#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression before evaluating it (many commands can be "
@@ -1708,18 +1709,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1754,6 +1756,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/es.po b/po/es.po
index fa951f724..ce2e695e5 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1603,18 +1603,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1649,6 +1650,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/fr.po b/po/fr.po
index 0491a7839..a048d1ef0 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
-"PO-Revision-Date: 2019-09-20 21:32+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
+"PO-Revision-Date: 2019-09-21 07:54+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -1677,18 +1677,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1723,6 +1724,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
@@ -1788,19 +1790,20 @@ msgstr ""
"suffixe,chaîne\" ou \"cutscr:+max,suffixe,chaîne\")\n"
" 5. une chaîne inversée (format : \"rev:xxx\")\n"
" 6. une chaîne répétée (format : \"repeat:nombre,chaîne\")\n"
-" 7. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
+" 7. longueur d'une chaîne (format : \"length:xxx\" ou \"lengthscr:xxx\")\n"
+" 8. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
"\", fonction \"color\")\n"
-" 8. une info (format : \"info:nom,paramètres\", les paramètres sont "
+" 9. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
-" 9. la date/heure courante (format : \"date\" ou \"date:format\")\n"
-" 10. une variable d'environnement (format : \"env:XXX\")\n"
-" 11. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
+" 10. la date/heure courante (format : \"date\" ou \"date:format\")\n"
+" 11. une variable d'environnement (format : \"env:XXX\")\n"
+" 12. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
"valeur_si_faux\")\n"
-" 12. le résultat d'une expression avec parenthèses et les opérateurs + - "
+" 13. le résultat d'une expression avec parenthèses et les opérateurs + - "
"* / // % (format: \"calc:xxx\")\n"
-" 13. une option (format : \"fichier.section.option\")\n"
-" 14. une variable locale du tampon\n"
-" 15. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
+" 14. une option (format : \"fichier.section.option\")\n"
+" 15. une variable locale du tampon\n"
+" 16. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
"par défaut \"window\" et \"buffer\" pointent vers la fenêtre et le tampon "
"courants.\n"
"Le format du hdata peut être le suivant :\n"
@@ -1837,6 +1840,7 @@ msgstr ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Exemples (conditions) :\n"
diff --git a/po/hu.po b/po/hu.po
index b68812891..18b61c8c2 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1491,18 +1491,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1537,6 +1538,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/it.po b/po/it.po
index 84b520900..1697d8c14 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1586,18 +1586,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1632,6 +1633,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/ja.po b/po/ja.po
index df75bbb66..201744a6c 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-06-22 08:40+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -1640,18 +1640,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1686,6 +1687,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/pl.po b/po/pl.po
index d8c252585..48323d901 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-09-07 15:45+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -1675,18 +1675,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1721,6 +1722,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/pt.po b/po/pt.po
index f10038ea7..cec414be9 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -1644,18 +1644,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1690,6 +1691,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 85ad42c6e..a191fb3a5 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1648,18 +1648,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1694,6 +1695,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/ru.po b/po/ru.po
index 5cb6cd347..b0c25eb3b 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1513,18 +1513,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1559,6 +1560,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/tr.po b/po/tr.po
index 15864b93d..02668053e 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1344,18 +1344,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1390,6 +1391,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index ef514054a..0fc2cbbc9 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-09-20 21:31+0200\n"
+"POT-Creation-Date: 2019-09-21 07:54+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1346,18 +1346,19 @@ msgid ""
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
-" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
+" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
+" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
-" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
-" 9. current date/time (format: \"date\" or \"date:format\")\n"
-" 10. an environment variable (format: \"env:XXX\")\n"
-" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
+" 9. an info (format: \"info:name,arguments\", arguments are optional)\n"
+" 10. current date/time (format: \"date\" or \"date:format\")\n"
+" 11. an environment variable (format: \"env:XXX\")\n"
+" 12. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
-" 12. result of an expression with parentheses and operators + - * / // % "
+" 13. result of an expression with parentheses and operators + - * / // % "
"(format: \"calc:xxx\")\n"
-" 13. an option (format: \"file.section.option\")\n"
-" 14. a local variable in buffer\n"
-" 15. a hdata name/variable (the value is automatically converted to "
+" 14. an option (format: \"file.section.option\")\n"
+" 15. a local variable in buffer\n"
+" 16. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@@ -1392,6 +1393,7 @@ msgid ""
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index d5d3846dd..d8a940fa1 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -7355,19 +7355,21 @@ command_init ()
"\"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
- " 7. a color (format: \"color:xxx\", see \"Plugin API "
+ " 7. length of a string (format: \"length:xxx\" or "
+ "\"lengthscr:xxx\")\n"
+ " 8. a color (format: \"color:xxx\", see \"Plugin API "
"reference\", function \"color\")\n"
- " 8. an info (format: \"info:name,arguments\", arguments are "
+ " 9. an info (format: \"info:name,arguments\", arguments are "
"optional)\n"
- " 9. current date/time (format: \"date\" or \"date:format\")\n"
- " 10. an environment variable (format: \"env:XXX\")\n"
- " 11. a ternary operator (format: "
+ " 10. current date/time (format: \"date\" or \"date:format\")\n"
+ " 11. an environment variable (format: \"env:XXX\")\n"
+ " 12. a ternary operator (format: "
"\"if:condition?value_if_true:value_if_false\")\n"
- " 12. result of an expression with parentheses and operators "
+ " 13. result of an expression with parentheses and operators "
"+ - * / // % (format: \"calc:xxx\")\n"
- " 13. an option (format: \"file.section.option\")\n"
- " 14. a local variable in buffer\n"
- " 15. a hdata name/variable (the value is automatically converted "
+ " 14. an option (format: \"file.section.option\")\n"
+ " 15. a local variable in buffer\n"
+ " 16. a hdata name/variable (the value is automatically converted "
"to string), by default \"window\" and \"buffer\" point to current "
"window/buffer.\n"
"Format for hdata can be one of following:\n"
@@ -7403,6 +7405,7 @@ command_init ()
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+ " /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index 547a4406b..15f5bc3b5 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -296,16 +296,18 @@ end:
* (format: cutscr:max,suffix,string or cutscr:+max,suffix,string)
* 6. a reversed string (format: rev:xxx)
* 7. a repeated string (format: repeat:count,string)
- * 8. a regex group captured (format: re:N (0.99) or re:+)
- * 9. a color (format: color:xxx)
- * 10. an info (format: info:name,arguments)
- * 11. current date/time (format: date or date:xxx)
- * 12. an environment variable (format: env:XXX)
- * 13. a ternary operator (format: if:condition?value_if_true:value_if_false)
- * 14. calculate result of an expression (format: calc:xxx)
- * 15. an option (format: file.section.option)
- * 16. a buffer local variable
- * 17. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
+ * 8. length of a string (format: length:xxx) or length of a string on screen
+ * (format: lengthscr:xxx)
+ * 9. a regex group captured (format: re:N (0.99) or re:+)
+ * 10. a color (format: color:xxx)
+ * 11. an info (format: info:name,arguments)
+ * 12. current date/time (format: date or date:xxx)
+ * 13. an environment variable (format: env:XXX)
+ * 14. a ternary operator (format: if:condition?value_if_true:value_if_false)
+ * 15. calculate result of an expression (format: calc:xxx)
+ * 16. an option (format: file.section.option)
+ * 17. a buffer local variable
+ * 18. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* or hdata[ptr].var1.var2)
*
* See /help in WeeChat for examples.
@@ -478,7 +480,25 @@ eval_replace_vars_cb (void *data, const char *text)
return string_repeat (pos + 1, number);
}
- /* 8. regex group captured */
+ /*
+ * 8. length of string:
+ * length: number of chars
+ * lengthscr: number of chars displayed on screen
+ */
+ if (strncmp (text, "length:", 7) == 0)
+ {
+ length = utf8_strlen (text + 7);
+ snprintf (str_value, sizeof (str_value), "%d", length);
+ return strdup (str_value);
+ }
+ if (strncmp (text, "lengthscr:", 10) == 0)
+ {
+ length = utf8_strlen_screen (text + 10);
+ snprintf (str_value, sizeof (str_value), "%d", length);
+ return strdup (str_value);
+ }
+
+ /* 9. regex group captured */
if (strncmp (text, "re:", 3) == 0)
{
if (eval_context->regex && eval_context->regex->result)
@@ -509,7 +529,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ("");
}
- /* 9. color code */
+ /* 10. color code */
if (strncmp (text, "color:", 6) == 0)
{
ptr_value = gui_color_search_config (text + 6);
@@ -519,7 +539,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ((ptr_value) ? ptr_value : "");
}
- /* 10. info */
+ /* 11. info */
if (strncmp (text, "info:", 5) == 0)
{
value = NULL;
@@ -539,7 +559,7 @@ eval_replace_vars_cb (void *data, const char *text)
return (value) ? value : strdup ("");
}
- /* 11. current date/time */
+ /* 12. current date/time */
if ((strncmp (text, "date", 4) == 0) && (!text[4] || (text[4] == ':')))
{
date = time (NULL);
@@ -552,7 +572,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ((rc > 0) ? str_value : "");
}
- /* 12. environment variable */
+ /* 13. environment variable */
if (strncmp (text, "env:", 4) == 0)
{
ptr_value = getenv (text + 4);
@@ -560,7 +580,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
- /* 13: ternary operator: if:condition?value_if_true:value_if_false */
+ /* 14: ternary operator: if:condition?value_if_true:value_if_false */
if (strncmp (text, "if:", 3) == 0)
{
value = NULL;
@@ -628,7 +648,7 @@ eval_replace_vars_cb (void *data, const char *text)
}
/*
- * 14. calculate the result of an expression
+ * 15. calculate the result of an expression
* (with number, operators and parentheses)
*/
if (strncmp (text, "calc:", 5) == 0)
@@ -636,7 +656,7 @@ eval_replace_vars_cb (void *data, const char *text)
return calc_expression (text + 5);
}
- /* 15. option: if found, return this value */
+ /* 16. option: if found, return this value */
if (strncmp (text, "sec.data.", 9) == 0)
{
ptr_value = hashtable_get (secure_hashtable_data, text + 9);
@@ -669,7 +689,7 @@ eval_replace_vars_cb (void *data, const char *text)
}
}
- /* 16. local variable in buffer */
+ /* 17. local variable in buffer */
ptr_buffer = hashtable_get (eval_context->pointers, "buffer");
if (ptr_buffer)
{
@@ -678,7 +698,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
- /* 17. hdata */
+ /* 18. hdata */
value = NULL;
hdata_name = NULL;
list_name = NULL;
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 4a208c1d0..d2a4da21e 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -363,6 +363,15 @@ TEST(CoreEval, EvalExpression)
WEE_CHECK_EVAL("cbacbacba", "${repeat:3,${rev:abc}}");
WEE_CHECK_EVAL("cbacba", "${repeat:${rev:20},${rev:abc}}");
+ /* test length of string */
+ WEE_CHECK_EVAL("0", "${length:}");
+ WEE_CHECK_EVAL("4", "${length:test}");
+ WEE_CHECK_EVAL("7", "${length:こんにちは世界}");
+
+ WEE_CHECK_EVAL("0", "${lengthscr:}");
+ WEE_CHECK_EVAL("4", "${lengthscr:test}");
+ WEE_CHECK_EVAL("14", "${lengthscr:こんにちは世界}");
+
/* test color */
WEE_CHECK_EVAL(gui_color_get_custom ("green"), "${color:green}");
WEE_CHECK_EVAL(gui_color_get_custom ("*214"), "${color:*214}");