Skip to content

Commit

Permalink
core: add syntax highlighting in evaluation of expressions, add optio…
Browse files Browse the repository at this point in the history
…n weechat.color.eval_syntax_colors (issue #2042)

Syntax highlighting (raw string without evaluation): `${raw_hl:xxx}`
Syntax highlighting: `${hl:xxx}`
  • Loading branch information
flashcode committed Nov 23, 2023
1 parent 2b0c274 commit 87f74e9
Show file tree
Hide file tree
Showing 26 changed files with 5,689 additions and 3,389 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele

New features::

* core: add syntax highlighting in evaluation of expressions with `raw_hl:string` and `hl:string`, add option weechat.color.eval_syntax_colors (issue #2042)
* core: add option `search_history` in command `/input`, add key kbd:[Ctrl+r] to search in commands history, add key context "histsearch" (issue #2040)
* core: add option weechat.look.buffer_search_history (issue #2040)
* core: add key kbd:[Ctrl+o] to send command found and insert next one in input (issue #2040)
Expand Down
12 changes: 11 additions & 1 deletion doc/en/weechat_plugin_api.en.adoc
Expand Up @@ -2567,7 +2567,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression

_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0._
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0, 4.2.0._

Evaluate an expression and return result as a string.
Special variables with format `+${variable}+` are expanded (see table below).
Expand Down Expand Up @@ -2900,11 +2900,21 @@ expanded to last):
|===
| Format | Min WeeChat | Description | Examples

| `+${raw_hl:xxx}+` | 4.2.0
| Raw string (not evaluated), with syntax highlighting (using colors).
| >> `+${raw_hl:${cut:1,,${rev:hello}}}+` +
== `+${cut:1,,${rev:hello}}+` (with colors)

| `+${raw:xxx}+` | 3.1
| Raw string (not evaluated).
| >> `+${raw:${info:version}}+` +
== `+${info:version}+`

| `+${hl:xxx}+` | 4.2.0
| String with syntax highlighting (using colors).
| >> `+${hl:${file.section.option}}+` +
== `+test ${variable}+` (with colors)

| `+${name}+` | 3.4
| User variable (defined with `+${define:name,value}+`).
| >> `+${name}+` +
Expand Down
13 changes: 12 additions & 1 deletion doc/fr/weechat_plugin_api.fr.adoc
Expand Up @@ -2613,7 +2613,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression

_WeeChat ≥ 0.4.0, mis à jour dans la 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8,
2.0, 2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0._
2.0, 2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0, 4.2.0._

Évaluer l'expression et retourner le résultat sous forme de chaîne.
Les variables spéciales avec le format `+${variable}+` sont étendues (voir le
Expand Down Expand Up @@ -2952,11 +2952,22 @@ première étendue à la dernière) :
|===
| Format | WeeChat mini | Description | Exemples

| `+${raw_hl:xxx}+` | 4.2.0
| Chaîne brute (non évaluée), avec mise en évidence de la syntaxe (en utilisant
des couleurs).
| >> `+${raw_hl:${cut:1,,${rev:hello}}}+` +
== `+${cut:1,,${rev:hello}}+` (avec des couleurs)

| `+${raw:xxx}+` | 3.1
| Chaîne brute (non évaluée).
| >> `+${raw:${info:version}}+` +
== `+${info:version}+`

| `+${hl:xxx}+` | 4.2.0
| Chaîne avec mise en évidence de la syntaxe (en utilisant des couleurs).
| >> `+${hl:${fichier.section.option}}+` +
== `+test ${variable}+` (avec des couleurs)

| `+${nom}+` | 3.4
| Variable définie par l'utilisateur (avec `+${define:nom,valeur}+`).
| >> `+${nom}+` +
Expand Down
12 changes: 11 additions & 1 deletion doc/it/weechat_plugin_api.it.adoc
Expand Up @@ -2717,7 +2717,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression

_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0._
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0, 4.2.0._

Evaluate an expression and return result as a string.
Special variables with format `+${variable}+` are expanded (see table below).
Expand Down Expand Up @@ -3050,11 +3050,21 @@ expanded to last):
|===
| Format | Min WeeChat | Description | Examples

| `+${raw_hl:xxx}+` | 4.2.0
| Raw string (not evaluated), with syntax highlighting (using colors).
| >> `+${raw_hl:${cut:1,,${rev:hello}}}+` +
== `+${cut:1,,${rev:hello}}+` (with colors)

| `+${raw:xxx}+` | 3.1
| Raw string (not evaluated).
| >> `+${raw:${info:version}}+` +
== `+${info:version}+`

| `+${hl:xxx}+` | 4.2.0
| String with syntax highlighting (using colors).
| >> `+${hl:${file.section.option}}+` +
== `+test ${variable}+` (with colors)

| `+${name}+` | 3.4
| User variable (defined with `+${define:name,value}+`).
| >> `+${name}+` +
Expand Down
14 changes: 13 additions & 1 deletion doc/ja/weechat_plugin_api.ja.adoc
Expand Up @@ -2637,7 +2637,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"

// TRANSLATION MISSING
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0._
2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8, 4.0.0, 4.2.0._

式を評価して文字列として返す。`+${variable}+`
という書式で書かれた特殊変数は展開されます (以下の表を参照)。
Expand Down Expand Up @@ -2980,12 +2980,24 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
// TRANSLATION MISSING
| 書式 | Min WeeChat | 説明 | 例

// TRANLSATION MISSING
| `+${raw_hl:xxx}+` | 4.2.0
| Raw string (not evaluated), with syntax highlighting (using colors).
| >> `+${raw_hl:${cut:1,,${rev:hello}}}+` +
== `+${cut:1,,${rev:hello}}+` (with colors)

// TRANSLATION MISSING
| `+${raw:xxx}+` | 3.1
| Raw string (not evaluated).
| >> `+${raw:${info:version}}+` +
== `+${info:version}+`

// TRANSLATION MISSING
| `+${hl:xxx}+` | 4.2.0
| String with syntax highlighting (using colors).
| >> `+${hl:${file.section.option}}+` +
== `+test ${variable}+` (with colors)

// TRANSLATION MISSING
| `+${name}+` | 3.4
| User variable (defined with `+${define:name,value}+`).
Expand Down
14 changes: 13 additions & 1 deletion doc/sr/weechat_plugin_api.sr.adoc
Expand Up @@ -2479,7 +2479,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"

==== string_eval_expression

_WeeChat ≥ 0.4.0, ажурирано у верзијама 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0, 2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6 и 3.8, 4.0.0._
_WeeChat ≥ 0.4.0, ажурирано у верзијама 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0, 2.2, 2.3, 2.7, 2.9, 3.1, 3.2, 3.3, 3.4, 3.6 и 3.8, 4.0.0, 4.2.0._

Израчунава израз и враћа вредност као стринг. Специјалне променљиве у формату `+${променљива}+` се развијају (погледајте табелу испод).

Expand Down Expand Up @@ -2789,11 +2789,23 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
|===
| Формат | Мин WeeChat | Опис | Примери

// TRANLSATION MISSING
| `+${raw_hl:xxx}+` | 4.2.0
| Raw string (not evaluated), with syntax highlighting (using colors).
| >> `+${raw_hl:${cut:1,,${rev:hello}}}+` +
== `+${cut:1,,${rev:hello}}+` (with colors)

| `+${raw:xxx}+` | 3.1
| Сирови стринг (не израчунава се).
| >> `+${raw:${info:version}}+` +
== `+${info:version}+`

// TRANSLATION MISSING
| `+${hl:xxx}+` | 4.2.0
| String with syntax highlighting (using colors).
| >> `+${hl:${file.section.option}}+` +
== `+test ${variable}+` (with colors)

| `+${име}+` | 3.4
| Корисничка променљива (дефинисана са `+${define:име,вредност}+`).
| >> `+${име}+` +
Expand Down
18 changes: 17 additions & 1 deletion po/cs.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-11-11 08:54+0100\n"
"POT-Creation-Date: 2023-11-23 08:13+0100\n"
"PO-Revision-Date: 2023-10-20 13:09+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -4792,6 +4792,19 @@ msgid ""
"(default value)"
msgstr ""

#. TRANSLATORS: please do not translate "lightred:blue"
#, fuzzy
#| msgid ""
#| "text color for nicks (comma separated list of colors, background is "
#| "allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgid ""
"text color for syntax highlighting in evaluated strings, with "
"\"${raw_hl:...}\" and \"${hl:...}\" (comma separated list of colors, "
"background is allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgstr ""
"barva textu pro přezdívky (čárkou oddělený seznam barev, pozadí je povoleno "
"ve formátu: \"fg:bg\", například: \"lightred:blue\")"

msgid "text color for actions in input line"
msgstr "barva textu pro akce ve vstupní řádce"

Expand Down Expand Up @@ -5696,6 +5709,9 @@ msgstr "Základní barvy WeeChat:"
msgid "Nick colors:"
msgstr "Barvy přezdívky:"

msgid "Syntax highlighting colors in evaluated strings:"
msgstr ""

msgid "Color aliases:"
msgstr "Aliasy barev:"

Expand Down
41 changes: 26 additions & 15 deletions po/de.po
Expand Up @@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-11-11 08:54+0100\n"
"POT-Creation-Date: 2023-11-23 08:13+0100\n"
"PO-Revision-Date: 2023-11-11 13:49+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
Expand Down Expand Up @@ -2199,7 +2199,6 @@ msgstr "> raw[search_text_here]: Textsuche, im Buffer, ab aktueller Position"
msgid "> raw[search_text]: search text in buffer"
msgstr "> raw[search_text]: Textsuche im Buffer"

#| msgid "> raw[search_text]: search text in buffer"
msgid "> raw[search_history]: search text in command line history"
msgstr "> raw[search_history]: suche Text im Befehlszeilenverlauf"

Expand Down Expand Up @@ -2348,10 +2347,10 @@ msgid ""
"search or recalled with \"up\"key) and insert the next history entry in the "
"command line without sending it"
msgstr ""
"> raw[history_use_get_next]: sendet den aktuellen Verlaufseintrag (welcher"
" mit der Suche gefunden wurde oder mit der „Auf“-Taste ausgewählt wurde) und"
" fügt den nächsten Verlaufseintrag in die Befehlszeile ein, ohne diesen zu"
" senden"
"> raw[history_use_get_next]: sendet den aktuellen Verlaufseintrag (welcher "
"mit der Suche gefunden wurde oder mit der „Auf“-Taste ausgewählt wurde) und "
"fügt den nächsten Verlaufseintrag in die Befehlszeile ein, ohne diesen zu "
"senden"

msgid ""
"> raw[grab_key]: grab a key (optional argument: delay for end of grab, "
Expand Down Expand Up @@ -4357,8 +4356,8 @@ msgstr ""
msgid ""
"default text search command line history: local (buffer) or global history"
msgstr ""
"Standard-Befehlszeilenverlauf für die Textsuche: lokaler (Buffer) oder"
" globaler Verlauf"
"Standard-Befehlszeilenverlauf für die Textsuche: lokaler (Buffer) oder "
"globaler Verlauf"

msgid ""
"force default values for text search in buffer (instead of using values from "
Expand Down Expand Up @@ -5437,6 +5436,20 @@ msgstr ""
"Textsuche); wird ausschließlich dann genutzt, falls die Einstellung weechat."
"look.emphasized_attributes keinen Eintrag besitzt (Standardwert)"

#. TRANSLATORS: please do not translate "lightred:blue"
#, fuzzy
#| msgid ""
#| "text color for nicks (comma separated list of colors, background is "
#| "allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgid ""
"text color for syntax highlighting in evaluated strings, with "
"\"${raw_hl:...}\" and \"${hl:...}\" (comma separated list of colors, "
"background is allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgstr ""
"Textfarbe für Nicks (durch Kommata getrennte Liste von Farben. Eine "
"Hintergrundfarbe kann durch das folgende Format genutzt werden: \"fg:bg\". "
"Zum Beispiel: \"lightred:blue\")"

msgid "text color for actions in input line"
msgstr ""
"Textfarbe in der Eingabezeile bei Aktivität (z.B. beim Einfügen von Zeilen)"
Expand Down Expand Up @@ -6437,6 +6450,9 @@ msgstr "WeeChat Basisfarben:"
msgid "Nick colors:"
msgstr "Farben für Nicks:"

msgid "Syntax highlighting colors in evaluated strings:"
msgstr ""

msgid "Color aliases:"
msgstr "Farbnamen:"

Expand Down Expand Up @@ -6594,11 +6610,9 @@ msgstr "lokal"
msgid "global"
msgstr "global"

#| msgid "Search"
msgid "Search lines"
msgstr "Suche Zeilen"

#| msgid "default command:"
msgid "Search command"
msgstr "Suche Befehl"

Expand Down Expand Up @@ -16407,8 +16421,7 @@ msgstr "verwaltet Trigger, das Schweizer Armeemesser für WeeChat"
msgid ""
"list [-o|-ol|-i|-il] || listfull || listdefault || add|addoff|addreplace "
"<name> <hook> "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<"
"return_code>\" [\"<post_action>\"]]]]]] "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<return_code>\" [\"<post_action>\"]]]]]] "
"|| addinput [<hook>] || input|output|recreate <name> || set <name> <option> "
"<value> || rename|copy <name> <new_name> || enable|disable|toggle [<name>|"
"<mask> [<name>|<mask>...]] || restart <name>|<mask> [<name>|<mask>...] || "
Expand All @@ -16417,8 +16430,7 @@ msgid ""
msgstr ""
"list [-o|-ol|-i|-il] || listfull || listdefault || add|addoff|addreplace "
"<name> <hook> "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<"
"return_code>\" [\"<post_action>\"]]]]]] "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<return_code>\" [\"<post_action>\"]]]]]] "
"|| addinput [<hook>] || input|output|recreate <name> || set <name> <option> "
"<value> || rename|copy <name> <new_name> || enable|disable|toggle [<name>|"
"<mask> [<name>|<mask>...]] || restart <name>|<mask> [<name>|<mask>...] || "
Expand Down Expand Up @@ -17416,4 +17428,3 @@ msgstr "%s%s: Zeitüberschreitung für \"%s\" mit %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr ""
"%s%s: Verbindung konnte nicht hergestellt werden: unerwarteter Fehler (%d)"

18 changes: 17 additions & 1 deletion po/es.po
Expand Up @@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-11-11 08:54+0100\n"
"POT-Creation-Date: 2023-11-23 08:13+0100\n"
"PO-Revision-Date: 2023-10-20 13:09+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -4957,6 +4957,19 @@ msgid ""
"(default value)"
msgstr ""

#. TRANSLATORS: please do not translate "lightred:blue"
#, fuzzy
#| msgid ""
#| "text color for nicks (comma separated list of colors, background is "
#| "allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgid ""
"text color for syntax highlighting in evaluated strings, with "
"\"${raw_hl:...}\" and \"${hl:...}\" (comma separated list of colors, "
"background is allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgstr ""
"color para los apodos (lista de colores separadas por comas, color de fondo "
"es permitido siguiendo el formato \"fg:bg\", por ejemplo: \"lightred:blue\")"

msgid "text color for actions in input line"
msgstr "color para acciones en la línea de entrada"

Expand Down Expand Up @@ -5872,6 +5885,9 @@ msgstr "Colores básicos de WeeChat:"
msgid "Nick colors:"
msgstr "Colores de apodos:"

msgid "Syntax highlighting colors in evaluated strings:"
msgstr ""

msgid "Color aliases:"
msgstr "Alias de colores:"

Expand Down
19 changes: 17 additions & 2 deletions po/fr.po
Expand Up @@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-11-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-11 08:57+0100\n"
"POT-Creation-Date: 2023-11-23 08:13+0100\n"
"PO-Revision-Date: 2023-11-23 08:16+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
Expand Down Expand Up @@ -5306,6 +5306,17 @@ msgstr ""
"recherche de texte) ; cette option est utilisée seulement si l'option "
"weechat.look.emphasized_attributes est une chaîne vide (valeur par défaut)"

#. TRANSLATORS: please do not translate "lightred:blue"
msgid ""
"text color for syntax highlighting in evaluated strings, with "
"\"${raw_hl:...}\" and \"${hl:...}\" (comma separated list of colors, "
"background is allowed with format: \"fg:bg\", for example: \"lightred:blue\")"
msgstr ""
"couleur du texte pour la mise en évidence de la syntaxe dans les chaînes "
"évaluées, avec \"${raw_hl:...}\" et \"${hl:...}\" (liste de couleurs "
"séparées par une virgule, un fond est autorisé avec le format : \"couleur:"
"fond\", par exemple : \"lightred:blue\")"

msgid "text color for actions in input line"
msgstr "couleur du texte pour les actions dans la ligne de saisie"

Expand Down Expand Up @@ -6303,6 +6314,10 @@ msgstr "Couleurs de base WeeChat :"
msgid "Nick colors:"
msgstr "Couleurs des pseudos :"

msgid "Syntax highlighting colors in evaluated strings:"
msgstr ""
"Couleurs pour la mise en évidence de la syntaxe dans les chaînes évaluées :"

msgid "Color aliases:"
msgstr "Alias de couleurs :"

Expand Down

0 comments on commit 87f74e9

Please sign in to comment.