From 6ea81f4c8c1067471f50c936ed27e013ce50f222 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 4 Aug 2013 10:09:53 +0200 Subject: [PATCH] api: add support of colors with format "${color:xxx}" in function string_eval_expression and command /eval --- ChangeLog | 2 ++ doc/de/autogen/user/weechat_commands.txt | 7 ++++--- doc/en/autogen/user/weechat_commands.txt | 7 ++++--- doc/fr/autogen/user/weechat_commands.txt | 7 ++++--- doc/it/autogen/user/weechat_commands.txt | 7 ++++--- doc/ja/autogen/user/weechat_commands.txt | 7 ++++--- po/cs.po | 9 +++++---- po/de.po | 9 +++++---- po/es.po | 9 +++++---- po/fr.po | 18 ++++++++++-------- po/hu.po | 9 +++++---- po/it.po | 9 +++++---- po/ja.po | 9 +++++---- po/pl.po | 9 +++++---- po/pt_BR.po | 9 +++++---- po/ru.po | 9 +++++---- po/tr.po | 9 +++++---- po/weechat.pot | 9 +++++---- src/core/wee-command.c | 7 ++++--- src/core/wee-eval.c | 23 +++++++++++++++-------- 20 files changed, 106 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e6fc82ad..766a6ab6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,8 @@ Version 0.4.2 (under dev!) "layout_window" * core: fix line alignment when option weechat.look.buffer_time_format is set to empty string +* api: add support of colors with format "${color:xxx}" in function + string_eval_expression and command /eval * api: add argument "options" in function string_eval_expression, add option "-c" for command /eval (to evaluate a condition) * api: use pointer for infolist "hook" to return only one hook diff --git a/doc/de/autogen/user/weechat_commands.txt b/doc/de/autogen/user/weechat_commands.txt index d67b971ce..58e8f94c2 100644 --- a/doc/de/autogen/user/weechat_commands.txt +++ b/doc/de/autogen/user/weechat_commands.txt @@ -233,9 +233,10 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. the name of an option (file.section.option) - 2. the name of a local variable in buffer - 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: color:xxx) + 2. an option (format: file.section.option) + 3. a local variable in buffer + 4. 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: diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 0885078d3..2b243b61e 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -233,9 +233,10 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. the name of an option (file.section.option) - 2. the name of a local variable in buffer - 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: color:xxx) + 2. an option (format: file.section.option) + 3. a local variable in buffer + 4. 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: diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index 6752c7592..c2545f071 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -233,9 +233,10 @@ Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque "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. le nom d'une option (fichier.section.option) - 2. le nom d'une variable locale du tampon - 3. le nom d'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. + 1. une couleur (format: color:xxx) + 2. une option (format: fichier.section.option) + 3. une variable locale du tampon + 4. un 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[list].var1.var2...: démarrer avec un hdata en utilisant une liste, par exemple : diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index e58f4e8a6..50259facf 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -233,9 +233,10 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. the name of an option (file.section.option) - 2. the name of a local variable in buffer - 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: color:xxx) + 2. an option (format: file.section.option) + 3. a local variable in buffer + 4. 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: diff --git a/doc/ja/autogen/user/weechat_commands.txt b/doc/ja/autogen/user/weechat_commands.txt index fa4876108..5da240956 100644 --- a/doc/ja/autogen/user/weechat_commands.txt +++ b/doc/ja/autogen/user/weechat_commands.txt @@ -233,9 +233,10 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. the name of an option (file.section.option) - 2. the name of a local variable in buffer - 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: color:xxx) + 2. an option (format: file.section.option) + 3. a local variable in buffer + 4. 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: diff --git a/po/cs.po b/po/cs.po index ad0baf9a5..8d81e124b 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:41+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1305,9 +1305,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/de.po b/po/de.po index 0224af6e7..e65ae8c42 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-08-01 19:57+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -1353,9 +1353,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/es.po b/po/es.po index 4bc4bdce6..23ff42e39 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:41+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -1342,9 +1342,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/fr.po b/po/fr.po index 4a73b8937..2d18e31cf 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 17:59+0200\n" -"PO-Revision-Date: 2013-08-03 15:06+0200\n" +"POT-Creation-Date: 2013-08-04 09:56+0200\n" +"PO-Revision-Date: 2013-08-04 09:10+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -1335,9 +1335,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1395,9 +1396,10 @@ msgstr "" "\n" "Des variables sont remplacées dans l'expression, en utilisant le format " "${variable}, la variable pouvant être, par ordre de priorité :\n" -" 1. le nom d'une option (fichier.section.option)\n" -" 2. le nom d'une variable locale du tampon\n" -" 3. le nom d'un hdata/variable (la valeur est automatiquement convertie en " +" 1. une couleur (format: color:xxx)\n" +" 2. une option (format: fichier.section.option)\n" +" 3. une variable locale du tampon\n" +" 4. un 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" diff --git a/po/hu.po b/po/hu.po index 29b802c19..b00655a3a 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:41+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1235,9 +1235,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/it.po b/po/it.po index 175f083a8..1e34cf5ab 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:41+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -1327,9 +1327,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/ja.po b/po/ja.po index b0d3fa047..425187591 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-08-02 08:50+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -1312,9 +1312,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/pl.po b/po/pl.po index 4aa658b11..0c9322edb 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-08-02 08:50+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -1342,9 +1342,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/pt_BR.po b/po/pt_BR.po index 40970ae09..36adba7c1 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:42+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -1373,9 +1373,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/ru.po b/po/ru.po index 893f2e0f9..c6a37c774 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:42+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1256,9 +1256,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/tr.po b/po/tr.po index f09fbb108..a9f6e9f43 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-07-31 18:42+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -1101,9 +1101,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/weechat.pot b/po/weechat.pot index 5a2fcfe0c..00e1ccb9c 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-08-03 15:05+0200\n" +"POT-Creation-Date: 2013-08-04 09:08+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -1107,9 +1107,10 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. the name of an option (file.section.option)\n" -" 2. the name of a local variable in buffer\n" -" 3. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: color:xxx)\n" +" 2. an option (format: file.section.option)\n" +" 3. a local variable in buffer\n" +" 4. 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" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 05116261b..b90bbd1fb 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -6379,9 +6379,10 @@ command_init () " \"50\" > \"100\" ==> 1\n\n" "Some variables are replaced in expression, using the " "format ${variable}, variable can be, by order of priority :\n" - " 1. the name of an option (file.section.option)\n" - " 2. the name of a local variable in buffer\n" - " 3. a hdata name/variable (the value is automatically " + " 1. a color (format: color:xxx)\n" + " 2. an option (format: file.section.option)\n" + " 3. a local variable in buffer\n" + " 4. 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" diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index 3db3cc8c2..0097103e8 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -215,9 +215,10 @@ end: /* * Replaces variables, which can be, by order of priority: * 1. an extra variable (from hashtable "extra_vars") - * 2. an name of option (file.section.option) - * 3. a buffer local variable - * 4. a hdata name/variable + * 2. a color (format: color:xxx) + * 3. an option (format: file.section.option) + * 4. a buffer local variable + * 5. a hdata name/variable * * Examples: * option: ${weechat.look.scroll_amount} @@ -245,12 +246,18 @@ eval_replace_vars_cb (void *data, const char *text) if (ptr_value) return strdup (ptr_value); - /* 2. look for name of option: if found, return this value */ + /* 2. look for a color */ + if (strncmp (text, "color:", 6) == 0) + { + ptr_value = gui_color_get_custom (text + 6); + return strdup ((ptr_value) ? ptr_value : ""); + } + + /* 3. look for name of option: if found, return this value */ if (strncmp (text, "sec.data.", 9) == 0) { ptr_value = hashtable_get (secure_hashtable_data, text + 9); - if (ptr_value) - return strdup (ptr_value); + return strdup ((ptr_value) ? ptr_value : ""); } else { @@ -277,7 +284,7 @@ eval_replace_vars_cb (void *data, const char *text) } } - /* 3. look for local variable in buffer */ + /* 4. look for local variable in buffer */ ptr_buffer = hashtable_get (pointers, "buffer"); if (ptr_buffer) { @@ -286,7 +293,7 @@ eval_replace_vars_cb (void *data, const char *text) return strdup (ptr_value); } - /* 4. look for hdata */ + /* 5. look for hdata */ value = NULL; hdata_name = NULL; list_name = NULL;