core: add cut of string with max chars displayed in evaluation of expressions

The syntax is: ${cutscr:max,suffix,string}.
The string is cut after max chars displayed on screen. If the string is cut,
the optional suffix is added after.
v2.8-utf8proc
Sébastien Helleu 2017-03-27 21:14:51 +02:00
parent f37ecbfefd
commit f99c866f35
31 changed files with 262 additions and 127 deletions

View File

@ -20,7 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add cut of string in evaluation of expressions (${cut:max,suffix,string})
* core: add cut of string in evaluation of expressions with "cut:" (number of chars) and "cutscr:" (number of chars displayed on screen)
* core: add ternary operator (condition) in evaluation of expressions (${if:condition?value_if_true:value_if_false})
* core: add resize of window parents with /window resize [h/v]size (task #11461, issue #893)
* buflist: new plugin "buflist" (bar item with list of buffers)

View File

@ -286,6 +286,7 @@ Some variables are replaced in expression, using the format ${variable}, variabl
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
@ -314,6 +315,8 @@ Examples (simple strings):
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big

View File

@ -286,6 +286,7 @@ Some variables are replaced in expression, using the format ${variable}, variabl
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
@ -314,6 +315,8 @@ Examples (simple strings):
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big

View File

@ -2042,11 +2042,19 @@ expanded to last):
| `+${cut:max,suffix,string}+` +
(_WeeChat ≥ 1.8_) |
String with `max` chars displayed, and optional `suffix` if string is cut. |
String with `max` chars, and optional `suffix` if string is cut. |
`+${cut:4,…,this is a test}+` +
`+${cut:2,>>,àéçôî}+` |
`+${cut:2,>>,こんにちは世界}+` |
`+this…+` +
`+àé>>+`
`+こん>>+`
| `+${cutscr:max,suffix,string}+` +
(_WeeChat ≥ 1.8_) |
String with `max` chars displayed on screen, and optional `suffix` if string is cut. |
`+${cutscr:4,…,this is a test}+` +
`+${cutscr:2,>>,こんにちは世界}+` |
`+this…+` +
`+こ>>+`
| `+${re:N}+` |
Regex captured group: `0` = whole string matching, `1` to `99` = group

View File

@ -257,53 +257,54 @@ infolists : afficher des infos sur les infolists
/eval [-n|-s] <expression>
[-n] -c <expression1> <opérateur> <expression2>
-n : afficher le résultat sans envoyer au tampon (mode debug)
-s : découper l'expression avant de l'évaluer (plusieurs commandes peuvent être séparées par des points-virgules)
-c : évaluer comme une condition : utiliser les opérateurs et les parenthèses, retourner une valeur booléenne ("0" ou "1")
expression : expression à évaluer, les variables avec le format ${variable} sont remplacées (voir ci-dessous) ; plusieurs commandes peuvent être séparées par des points-virgules
opérateur : un opérateur logique ou de comparaison :
- opérateurs logiques :
&& "et" booléen
|| "ou" booléen
- opérateurs de comparaison :
== égal
!= non égal
<= inférieur ou égal
< inférieur
>= supérieur ou égal
> supérieur
=~ correspond à l'expression régulière POSIX étendue
!~ ne correspond PAS à l'expression régulière POSIX étendue
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
operator: a logical or comparison operator:
- logical operators:
&& boolean "and"
|| boolean "or"
- comparison operators:
== equal
!= not equal
<= less or equal
< less
>= greater or equal
> greater
=~ is matching POSIX extended regex
!~ is NOT matching POSIX extended regex
Une expression est considérée comme "vraie" si elle est non NULL, non vide, et différente de "0".
La comparaison est faite en utilisant des entiers si les deux expressions sont des entiers valides.
Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque expression, par exemple :
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using integers if the two expressions are valid integers.
To force a string comparison, add double quotes around each expression, for example:
50 > 100 ==> 0
"50" > "100" ==> 1
Des variables sont remplacées dans l'expression, en utilisant le format ${variable}, la variable pouvant être, par ordre de priorité :
1. une sous-chaîne évaluée (format : "eval:xxx")
2. une chaîne avec les caractères échappés (format : "esc:xxx" ou "\xxx")
3. une chaîne avec des caractères à cacher (format : "hide:caractère,chaîne")
4. une chaîne avec un maximum de caractères (format : "cut:max,suffixe,chaîne")
5. une couleur (format : "color:xxx")
6. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
7. la date/heure courante (format : "date" ou "date:format")
8. une variable d'environnement (format : "env:XXX")
9. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
10. une option (format : "fichier.section.option")
11. une variable locale du tampon
12. 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 :
${buffer[gui_buffers].full_name} : nom complet du premier tampon dans la liste chaînée des tampons
${plugin[weechat_plugins].name} : nom de la première extension dans la liste chaînée des extensions
hdata[pointeur].var1.var2... : démarrer avec un hdata en utilisant un pointeur, par exemple :
${buffer[0x1234abcd].full_name} : nom complet du tampon avec ce pointeur (peut être utilisé dans les triggers)
Pour le nom du hdata et des variables, voir la "Référence API extension", fonction "weechat_hdata_get".
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
8. an environment variable (format: "env:XXX")
9. a ternary operator (format: "if:condition?value_if_true:value_if_false")
10. an option (format: "file.section.option")
11. a local variable in buffer
12. 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:
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Exemples (chaînes simples) :
Examples (simple strings):
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
@ -314,10 +315,12 @@ Exemples (chaînes simples) :
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
Exemples (conditions) :
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1

View File

@ -2085,11 +2085,19 @@ première étendue à la dernière) :
| `+${cut:max,suffixe,chaîne}+` +
(_WeeChat ≥ 1.8_) |
Chaîne avec `max` caractères affichés, et un `suffixe` facultatif si la chaîne est coupée. |
Chaîne avec `max` caractères, et un `suffixe` facultatif si la chaîne est coupée. |
`+${cut:4,…,ceci est un test}+` +
`+${cut:2,>>,àéçôî}+` |
`+${cut:2,>>,こんにちは世界}+` |
`+ceci…+` +
`+àé>>+`
`+こん>>+`
| `+${cutscr:max,suffixe,chaîne}+` +
(_WeeChat ≥ 1.8_) |
Chaîne avec `max` caractères affichés à l'écran, et un `suffixe` facultatif si la chaîne est coupée. |
`+${cutscr:4,…,ceci est un test}+` +
`+${cutscr:2,>>,こんにちは世界}+` |
`+ceci…+` +
`+こ>>+`
| `+${re:N}+` |
Groupe regex capturé : `0` = toute la chaîne correspondante,

View File

@ -286,6 +286,7 @@ Some variables are replaced in expression, using the format ${variable}, variabl
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
@ -314,6 +315,8 @@ Examples (simple strings):
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big

View File

@ -2120,11 +2120,19 @@ expanded to last):
| `+${cut:max,suffix,string}+` +
(_WeeChat ≥ 1.8_) |
String with `max` chars displayed, and optional `suffix` if string is cut. |
String with `max` chars, and optional `suffix` if string is cut. |
`+${cut:4,…,this is a test}+` +
`+${cut:2,>>,àéçôî}+` |
`+${cut:2,>>,こんにちは世界}+` |
`+this…+` +
`+àé>>+`
`+こん>>+`
| `+${cutscr:max,suffix,string}+` +
(_WeeChat ≥ 1.8_) |
String with `max` chars displayed on screen, and optional `suffix` if string is cut. |
`+${cutscr:4,…,this is a test}+` +
`+${cutscr:2,>>,こんにちは世界}+` |
`+this…+` +
`+こ>>+`
| `+${re:N}+` |
Regex captured group: `0` = whole string matching, `1` to `99` = group

View File

@ -257,53 +257,54 @@ infolists: インフォリストに関する情報を表示
/eval [-n|-s] <expression>
[-n] -c <expression1> <operator> <expression2>
-n: 結果をバッファに送信せずに表示 (デバッグモード)
-s: 評価前に式を分割する (複数のコマンドを指定する場合はセミコロンで区切ってください)
-c: 条件として評価: 演算子と括弧をを使い、ブール値 ("0" または "1") を返します
expression: 評価する式、${variable} 型の書式の変数は置換されます (以下を参照); 複数のコマンドを指定する場合はセミコロンで区切ってください
operator: 論理演算子や比較演算子:
- 論理演算子:
&& ブール演算の "and"
|| ブール演算の "or"
- 比較演算子:
== 等しい
!= 等しくない
<= 以下
< より少ない
>= 以上
> より大きい
=~ 正規表現にマッチ
!~ 正規表現にマッチしない
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
operator: a logical or comparison operator:
- logical operators:
&& boolean "and"
|| boolean "or"
- comparison operators:
== equal
!= not equal
<= less or equal
< less
>= greater or equal
> greater
=~ is matching POSIX extended regex
!~ is NOT matching POSIX extended regex
式が NULL でない場合、空でない場合、"0" でない場合、式は "真" と評価されます。
両方の式が有効な整数である場合、比較は整数を使って行われます。
文字列比較を強制するには、それぞれの式をダブルクォートで囲みます、例:
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using integers if the two expressions are valid integers.
To force a string comparison, add double quotes around each expression, for example:
50 > 100 ==> 0
"50" > "100" ==> 1
式中の ${variable} 型の書式の変数は置換されます。変数は以下の優先順位に従います:
1. 評価済みのサブ文字列 (書式: "eval:xxx")
2. エスケープ文字を含む文字列 (書式: "esc:xxx" または "\xxx")
3. 隠す文字を含む文字列 (書式: "hide:char,string")
4. 最大文字数を指定した文字列 (書式: "cut:max,suffix,string")
5. 色 (書式: "color:xxx")
6. 情報 (書式: "info:name,arguments"、arguments は任意)
7. 現在の日付/時刻 (書式: "date" または "date:format")
8. 環境変数 (書式: "env:XXX")
9. 三項演算子 (書式: "if:condition?value_if_true:value_if_false")
10. オプション (書式: "file.section.option")
11. バッファのローカル変数
12. hdata の名前/変数 (値は自動的に文字列に変換されます)、デフォルトでは "window" と "buffer" は現在のウィンドウ/バッファを指します。
hdata の書式は以下の 1 つです:
hdata.var1.var2...: hdata (ポインタは既知) で開始し、1 個ずつ変数を続ける (他の hdata を続けることも可能)
hdata[list].var1.var2...: リストを使う hdata で開始する、例:
${buffer[gui_buffers].full_name}: バッファリストにリンクされた最初のバッファのフルネーム
${plugin[weechat_plugins].name}: プラグインリストにリンクされた最初のプラグインの名前
hdata[pointer].var1.var2...: ポインタを使う hdata で開始する、例:
${buffer[0x1234abcd].full_name}: 与えたポインタを持つバッファの完全な名前 (トリガ中で使うことが可能です)
hdata と変数の名前については、"プラグイン API リファレンス" の "weechat_hdata_get" 関数を参照してください。
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
8. an environment variable (format: "env:XXX")
9. a ternary operator (format: "if:condition?value_if_true:value_if_false")
10. an option (format: "file.section.option")
11. a local variable in buffer
12. 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:
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
例 (単純な文字列):
Examples (simple strings):
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
@ -314,10 +315,12 @@ hdata と変数の名前については、"プラグイン API リファレン
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
例 (条件):
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1

View File

@ -2046,13 +2046,23 @@ char *weechat_string_eval_expression (const char *expr,
`+${hide:*,password}+` |
`+********+`
// TRANSLATION MISSING
| `+${cut:max,suffix,string}+` +
(_WeeChat バージョン 1.8 以上で利用可_) |
`string` の先頭 `max` 文字を表示し、`string` の文字数が `max` 文字を超える場合にはオプションの `suffix` も表示します |
String with `max` chars, and optional `suffix` if string is cut. |
`+${cut:4,…,this is a test}+` +
`+${cut:2,>>,àéçôî}+` |
`+${cut:2,>>,こんにちは世界}+` |
`+this…+` +
`+àé>>+`
`+こん>>+`
// TRANSLATION MISSING
| `+${cutscr:max,suffix,string}+` +
(_WeeChat バージョン 1.8 以上で利用可_) |
String with `max` chars displayed on screen, and optional `suffix` if string is cut. |
`+${cutscr:4,…,this is a test}+` +
`+${cutscr:2,>>,こんにちは世界}+` |
`+this…+` +
`+こ>>+`
| `+${re:N}+` |
正規表現のキャプチャグループ: `0` = マッチするすべての文字列、`1` から `99` =

View File

@ -286,6 +286,7 @@ Some variables are replaced in expression, using the format ${variable}, variabl
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string")
5. a color (format: "color:xxx")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
@ -314,6 +315,8 @@ Examples (simple strings):
/eval -n ${\t} ==> <tab>
/eval -n ${hide:-,${relay.network.password}} ==> --------
/eval -n ${cut:2,+,test} ==> te+
/eval -n ${cut:2,+,こんにちは世界} ==> こん+
/eval -n ${cutscr:2,+,こんにちは世界} ==> こ+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 21:59+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1472,6 +1472,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1509,6 +1511,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-03-12 21:27+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1575,6 +1575,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1612,6 +1614,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:01+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1504,6 +1504,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1541,6 +1543,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"PO-Revision-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-03-27 21:12+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -1551,6 +1551,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1588,6 +1590,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"
@ -1642,6 +1646,8 @@ msgstr ""
"chaîne\")\n"
" 4. une chaîne avec un maximum de caractères (format : \"cut:max,suffixe,"
"chaîne\")\n"
" ou un maximum de caractères affichés à l'écran (format : \"cutscr:max,"
"suffixe,chaîne\")\n"
" 5. une couleur (format : \"color:xxx\")\n"
" 6. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
@ -1682,6 +1688,8 @@ msgstr ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:03+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1394,6 +1394,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1431,6 +1433,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:04+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1487,6 +1487,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1524,6 +1526,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-03-26 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -1479,6 +1479,7 @@ msgstr "式を評価"
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 "
@ -1516,6 +1517,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1553,6 +1556,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:05+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1551,6 +1551,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1588,6 +1590,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-14 21:39+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -1540,6 +1540,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1577,6 +1579,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2016-09-03 08:24+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1549,6 +1549,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1586,6 +1588,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:06+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1416,6 +1416,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1453,6 +1455,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+0200\n"
"PO-Revision-Date: 2017-01-06 22:07+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1250,6 +1250,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1287,6 +1289,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-03-25 22:12+0100\n"
"POT-Creation-Date: 2017-03-27 21:10+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"
@ -1253,6 +1253,8 @@ msgid ""
" 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"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string"
"\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 7. current date/time (format: \"date\" or \"date:format\")\n"
@ -1290,6 +1292,8 @@ msgid ""
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -7270,6 +7270,8 @@ command_init ()
" 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"
" or max chars displayed on screen "
"(format: \"cutscr:max,suffix,string\")\n"
" 5. a color (format: \"color:xxx\")\n"
" 6. an info (format: \"info:name,arguments\", arguments are "
"optional)\n"
@ -7309,6 +7311,8 @@ command_init ()
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${cut:2,+,test} ==> te+\n"
" /eval -n ${cut:2,+,こんにちは世界} ==> こん+\n"
" /eval -n ${cutscr:2,+,こんにちは世界} ==> こ+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"

View File

@ -296,6 +296,7 @@ end:
* 3. a string with escaped chars (format: esc:xxx or \xxx)
* 4. a string with chars to hide (format: hide:char,string)
* 5. a string with max chars (format: cut:max,suffix,string)
* or max chars on screen (format: cutscr:max,suffix,string)
* 6. a regex group captured (format: re:N (0.99) or re:+)
* 7. a color (format: color:xxx)
* 8. an info (format: info:name,arguments)
@ -324,7 +325,7 @@ eval_replace_vars_cb (void *data, const char *text)
const char *prefix, *suffix, *ptr_value, *ptr_arguments, *ptr_string;
struct t_hdata *hdata;
void *pointer;
int i, length_hide_char, length, index, rc, extra_vars_eval;
int i, length_hide_char, length, index, rc, extra_vars_eval, screen;
long number;
long unsigned int ptr;
time_t date;
@ -413,18 +414,32 @@ eval_replace_vars_cb (void *data, const char *text)
}
/*
* 5. cut chars: max number of chars, and add an optional suffix when the
* string is cut
* 5. cut chars:
* cut: max number of chars, and add an optional suffix when the
* string is cut
* cutscr: max number of chars displayed on screen, and add an optional
* suffix when the string is cut
*/
if (strncmp (text, "cut:", 4) == 0)
if ((strncmp (text, "cut:", 4) == 0)
|| (strncmp (text, "cutscr:", 7) == 0))
{
pos = strchr (text + 4, ',');
if (strncmp (text, "cut:", 4) == 0)
{
screen = 0;
length = 4;
}
else
{
screen = 1;
length = 7;
}
pos = strchr (text + length, ',');
if (!pos)
return strdup ("");
pos2 = strchr (pos + 1, ',');
if (!pos2)
return strdup ("");
tmp = strndup (text + 4, pos - text - 4);
tmp = strndup (text + length, pos - text - length);
if (!tmp)
return strdup ("");
number = strtol (tmp, &error, 10);
@ -437,7 +452,7 @@ eval_replace_vars_cb (void *data, const char *text)
tmp = strndup (pos + 1, pos2 - pos - 1);
if (!tmp)
return strdup ("");
value = string_cut (pos2 + 1, number, tmp);
value = string_cut (pos2 + 1, number, screen, tmp);
free (tmp);
return value;
}

View File

@ -96,17 +96,23 @@ string_strndup (const char *string, int length)
* Cuts a string after max "length" chars, adds an optional suffix
* after the string if it is cut.
*
* If screen == 1, the cut is based on width of chars displayed.
*
* Note: result must be freed after use.
*/
char *
string_cut (const char *string, int length, const char *cut_suffix)
string_cut (const char *string, int length, int screen, const char *cut_suffix)
{
int length_result, length_cut_suffix;
char *result;
const char *ptr_string;
ptr_string = gui_chat_string_add_offset (string, length);
if (screen)
ptr_string = gui_chat_string_add_offset_screen (string, length);
else
ptr_string = gui_chat_string_add_offset (string, length);
if (!ptr_string[0])
{
/* no cut */

View File

@ -36,7 +36,7 @@ struct t_string_dyn
struct t_hashtable;
extern char *string_strndup (const char *string, int length);
extern char *string_cut (const char *string, int length,
extern char *string_cut (const char *string, int length, int screen,
const char *cut_suffix);
extern void string_tolower (char *string);
extern void string_toupper (char *string);

View File

@ -126,8 +126,8 @@ main (int argc, char *argv[])
int rc, length, weechat_argc;
char *weechat_tests_args, *args, **weechat_argv;
/* setup environment: default language, no specific timezone */
setenv ("LC_ALL", "C", 1);
/* setup environment: English language, no specific timezone */
setenv ("LC_ALL", "en_US.UTF-8", 1);
setenv ("TZ", "", 1);
/* build arguments for WeeChat */

View File

@ -227,6 +227,8 @@ TEST(Eval, EvalExpression)
WEE_CHECK_EVAL("te+", "${cut:2,+,test}");
WEE_CHECK_EVAL("éà", "${cut:2,,éàô}");
WEE_CHECK_EVAL("éà+", "${cut:2,+,éàô}");
WEE_CHECK_EVAL("こん+", "${cut:2,+,こんにちは世界}");
WEE_CHECK_EVAL("こ+", "${cutscr:2,+,こんにちは世界}");
/* test color */
WEE_CHECK_EVAL(gui_color_get_custom ("green"), "${color:green}");

View File

@ -354,8 +354,7 @@ TEST(Utf8, Size)
LONGS_EQUAL(1, utf8_char_size_screen ("A"));
LONGS_EQUAL(1, utf8_char_size_screen ("ë"));
LONGS_EQUAL(1, utf8_char_size_screen (""));
/* this test does not work on Ubuntu Precise: it returns 2 instead of 1 */
/*LONGS_EQUAL(1, utf8_char_size_screen (han_char));*/
LONGS_EQUAL(2, utf8_char_size_screen (han_char));
/* length of string (in chars) */
LONGS_EQUAL(0, utf8_strlen (NULL));