mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 17:23:15 +02:00
core: add "length:xxx" and "lengthscr:xxx" in evaluation of expressions
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) :
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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` =
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user