From 9a268ec7cce057ea02b3ac74c709b69ad494c927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 27 Aug 2023 08:03:40 +0200 Subject: [PATCH] core: evaluate command given to `/repeat` with contextual variables (closes #2007) --- ChangeLog.adoc | 1 + po/cs.po | 17 ++++- po/de.po | 168 ++++++++++++----------------------------- po/es.po | 17 ++++- po/fr.po | 34 ++++++++- po/hu.po | 17 ++++- po/it.po | 17 ++++- po/ja.po | 17 ++++- po/pl.po | 17 ++++- po/pt.po | 17 ++++- po/pt_BR.po | 17 ++++- po/ru.po | 17 ++++- po/sr.po | 17 ++++- po/tr.po | 17 ++++- po/weechat.pot | 17 ++++- src/core/wee-command.c | 168 ++++++++++++++++++++++++++++++----------- src/core/wee-command.h | 11 ++- 17 files changed, 391 insertions(+), 195 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 5dcf1c3f5..85592cf9f 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele New features:: + * core: evaluate command given to `/repeat` with contextual variables (issue #2007) * core: add option `callbacks` in command `/debug` * core: add option type "enum" (issue #1973) * core: add options weechat.buffer.* to save buffer properties set by user, add option `setauto` in command `/buffer` (issue #352) diff --git a/po/cs.po b/po/cs.po index fe322a61e..807aaa43d 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 20:02+0200\n" +"POT-Creation-Date: 2023-08-27 07:57+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -2445,7 +2445,20 @@ msgid "" " h: hours\n" " count: number of times to execute command\n" "command: command to execute (or text to send to buffer if command does not " -"start with '/')\n" +"start with '/'), evaluated and the following variables are set each time the " +"command is executed:\n" +" ${buffer}: buffer pointer\n" +" ${repeat_count}: number of times the command is executed\n" +" ${repeat_index}: current index (from 1 to \"count\")\n" +" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n" +" ${repeat_revindex}: current index from the end (from \"count\" to " +"1)\n" +" ${repeat_revindex0}: current index from the end (from \"count\" - " +"1 to 0)\n" +" ${repeat_first}: \"1\" for the first execution, \"0\" for the " +"others\n" +" ${repeat_last}: \"1\" for the last execution, \"0\" for the " +"others\n" "\n" "Note: the command is executed on buffer where /repeat was executed (if the " "buffer does not exist any more, the command is not executed).\n" diff --git a/po/de.po b/po/de.po index 64b812f73..d9abb8fe6 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 20:02+0200\n" +"POT-Creation-Date: 2023-08-27 07:57+0200\n" "PO-Revision-Date: 2023-08-27 00:11+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -433,11 +433,9 @@ msgstr "" "Der Inhalt des Buffers wurde im Rohformat in die Protokolldatei geschrieben" #, c-format -#| msgid "Debug enabled for cursor mode (%s)" msgid "Debug enabled for callbacks (threshold: %s)" msgstr "Debug für callbacks aktiviert (Schwellenwert: %s)" -#| msgid "Debug disabled for \"%s\"" msgid "Debug disabled for callbacks" msgstr "Debug für callbacks deaktiviert" @@ -1628,10 +1626,6 @@ msgstr "" msgid "debug functions" msgstr "Debug-Funktionen" -#| msgid "" -#| "list || set || dump|hooks [] || buffer|certs|" -#| "color|dirs|infolists|libs|memory|tags|term|windows || mouse|cursor " -#| "[verbose] || hdata [free] || time || unicode " msgid "" "list || set || dump|hooks [] || buffer|certs|color|" "dirs|infolists|libs|memory|tags|term|windows || callbacks [] " @@ -1643,41 +1637,6 @@ msgstr "" "|| mouse|cursor [verbose] || hdata [free] || time || unicode " "" -#| msgid "" -#| " list: list plugins with debug levels\n" -#| " set: set debug level for plugin\n" -#| " plugin: name of plugin (\"core\" for WeeChat core)\n" -#| " level: debug level for plugin (0 = disable debug)\n" -#| " dump: save memory dump in WeeChat log file (same dump is written " -#| "when WeeChat crashes)\n" -#| " hooks: display infos about hooks (with a plugin: display detailed " -#| "info about hooks created by the plugin)\n" -#| " buffer: dump buffer content with hexadecimal values in log file\n" -#| " certs: display number of loaded trusted certificate authorities\n" -#| " color: display infos about current color pairs\n" -#| " cursor: toggle debug for cursor mode\n" -#| " dirs: display directories\n" -#| " hdata: display infos about hdata (with free: remove all hdata in " -#| "memory)\n" -#| "infolists: display infos about infolists\n" -#| " key: enable keyboard and mouse debug: display raw codes, expanded " -#| "key name and associated command ('q' to quit this mode)\n" -#| " libs: display infos about external libraries used\n" -#| " memory: display infos about memory usage\n" -#| " mouse: toggle debug for mouse\n" -#| " tags: display tags for lines\n" -#| " term: display infos about terminal\n" -#| " windows: display windows tree\n" -#| " time: measure time to execute a command or to send text to the " -#| "current buffer\n" -#| " unicode: display information about string and unicode chars (evaluated, " -#| "see /help eval)\n" -#| "\n" -#| "Examples:\n" -#| " /debug set irc 1\n" -#| " /debug mouse verbose\n" -#| " /debug time /filter toggle\n" -#| " /debug unicode ${chars:${\\u26C0}-${\\u26CF}}" msgid "" " list: list plugins with debug levels\n" " set: set debug level for plugin\n" @@ -1733,9 +1692,9 @@ msgstr "" "wurden)\n" " buffer: speichert den Bufferinhalt als hexadezimale Ausgabe in die " "Protokolldatei\n" -"callbacks: schreibt Hook und Bar-Item Callbacks, welche länger als die" -" angegebene \"Dauer\", ausgeführt werden in die WeeChat Protokolldatei (0 =" -" deaktiviert), wobei dabei eine der optionalen Einheiten genutzt wird:\n" +"callbacks: schreibt Hook und Bar-Item Callbacks, welche länger als die " +"angegebene \"Dauer\", ausgeführt werden in die WeeChat Protokolldatei (0 = " +"deaktiviert), wobei dabei eine der optionalen Einheiten genutzt wird:\n" " us: Mikrosekunden (default)\n" " ms: Millisekunden\n" " s: Sekunden\n" @@ -3184,9 +3143,11 @@ msgstr "führt einen Befehl mehrfach aus" msgid "[-interval []] " msgstr "[-interval []] " +#, fuzzy #| msgid "" -#| " delay: delay between execution of commands\n" +#| " delay: delay between execution of commands (minimum: 1 millisecond)\n" #| " unit: optional, values are:\n" +#| " us: microseconds\n" #| " ms: milliseconds\n" #| " s: seconds (default)\n" #| " m: minutes\n" @@ -3211,7 +3172,20 @@ msgid "" " h: hours\n" " count: number of times to execute command\n" "command: command to execute (or text to send to buffer if command does not " -"start with '/')\n" +"start with '/'), evaluated and the following variables are set each time the " +"command is executed:\n" +" ${buffer}: buffer pointer\n" +" ${repeat_count}: number of times the command is executed\n" +" ${repeat_index}: current index (from 1 to \"count\")\n" +" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n" +" ${repeat_revindex}: current index from the end (from \"count\" to " +"1)\n" +" ${repeat_revindex0}: current index from the end (from \"count\" - " +"1 to 0)\n" +" ${repeat_first}: \"1\" for the first execution, \"0\" for the " +"others\n" +" ${repeat_last}: \"1\" for the last execution, \"0\" for the " +"others\n" "\n" "Note: the command is executed on buffer where /repeat was executed (if the " "buffer does not exist any more, the command is not executed).\n" @@ -3220,8 +3194,8 @@ msgid "" " scroll 2 pages up:\n" " /repeat 2 /window page_up" msgstr "" -" delay: Verzögerung zwischen dem Ausführen der Befehle (Minimum: 1" -" Millisekunde)\n" +" delay: Verzögerung zwischen dem Ausführen der Befehle (Minimum: 1 " +"Millisekunde)\n" " unit: mögliche, optionale, Werte):\n" " us: Mikrosekunden\n" " ms: Millisekunden\n" @@ -3731,26 +3705,6 @@ msgstr "Terminiere einen Befehl der ausgeführt werden soll" msgid "[] " msgstr "[] " -#| msgid "" -#| " number: amount of time to wait (integer number)\n" -#| " unit: optional, values are:\n" -#| " ms: milliseconds\n" -#| " s: seconds (default)\n" -#| " m: minutes\n" -#| " h: hours\n" -#| "command: command to execute (or text to send to buffer if command does " -#| "not start with '/')\n" -#| "\n" -#| "Note: the command is executed on buffer where /wait was executed (if the " -#| "buffer does not exist any more, the command is not executed).\n" -#| "\n" -#| "Examples:\n" -#| " join channel in 10 seconds:\n" -#| " /wait 10 /join #test\n" -#| " set away in 15 minutes:\n" -#| " /wait 15m /away -all I'm away\n" -#| " say 'hello' in 2 minutes:\n" -#| " /wait 2m hello" msgid "" " number: amount of time to wait (minimum: 1 millisecond)\n" " unit: optional, values are:\n" @@ -4184,10 +4138,6 @@ msgstr "" "%sWarnung: unbekannte Einstellung für Sektion \"%s\": %s (Wert: \"%s\")" #, c-format -#| msgid "" -#| "set property \"%s\" on any buffer matching mask \"%s\"; content is " -#| "evaluated, see /help eval; ${buffer} is a pointer to the buffer being " -#| "opened" msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " "evaluated, see /help eval; ${buffer} is a pointer to the buffer being " @@ -4195,8 +4145,8 @@ msgid "" msgstr "" "Setze Eigenschaft „%s“ bei jedem Buffer, der mit der Maske „%s“ " "übereinstimmt; Inhalt ist evaluiert, siehe /help eval; ${buffer} ist ein " -"Zeiger auf den Buffer, der geöffnet wird, ${property} ist der Name der" -" Eigenschaft, die festgelegt wird" +"Zeiger auf den Buffer, der geöffnet wird, ${property} ist der Name der " +"Eigenschaft, die festgelegt wird" #, c-format msgid "Option \"weechat.buffer.%s\" has been set to \"%s\"" @@ -5926,9 +5876,8 @@ msgid "" "debug: long callback: hook %s (%s), plugin: %s, subplugin: %s, time elapsed: " "%s" msgstr "" -"Debug: langer Callback: Hook %s (%s), Erweiterung: %s, Untererweiterung: %s," -" verstrichene Zeit: " -"%s" +"Debug: langer Callback: Hook %s (%s), Erweiterung: %s, Untererweiterung: %s, " +"verstrichene Zeit: %s" #, c-format msgid "%sError sending signal %d to pid %d: %s" @@ -6461,8 +6410,8 @@ msgstr "Infobar \"%s\" aktualisiert" #, c-format msgid "debug: long callback: bar: %s, item: %s, plugin: %s, time elapsed: %s" msgstr "" -"Debug: langer Callback: Bar: %s, Item: %s, Erweiterung: %s, verstrichene" -" Zeit: %s" +"Debug: langer Callback: Bar: %s, Item: %s, Erweiterung: %s, verstrichene " +"Zeit: %s" #, c-format msgid "%sPaste %d line? [ctrl-y] Yes [ctrl-n] No" @@ -12211,39 +12160,29 @@ msgstr "Nicknamen des IRC-Hosts erhalten" msgid "IRC host (like `:nick!name@server.com`)" msgstr "IRC host (in der Form `:nick!name@server.com`)" -#| msgid "" -#| "get nick color code (nick is first converted to lower case, following the " -#| "value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the " -#| "server is not given)" msgid "" "get nick color code, ignoring case (this calls the info " "\"nick_color_ignore_case\" with appropriate range, according to the value of " "CASEMAPPING on the server, defaulting to \"rfc1459\" if the server is not " "given)" msgstr "" -"Hole den Farbcode des Nicks, Groß- und Kleinschreibung wird ignoriert (dies" -" ruft die Funktion" -"„nick_color_name_ignore_case“ mit entsprechendem Bereich auf, dabei wird der" -" Wert des CASEMAPPING auf dem Server" -"berücksichtigt, standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn der" -"Server nicht angegeben wurde)" +"Hole den Farbcode des Nicks, Groß- und Kleinschreibung wird ignoriert (dies " +"ruft die Funktion„nick_color_name_ignore_case“ mit entsprechendem Bereich " +"auf, dabei wird der Wert des CASEMAPPING auf dem Serverberücksichtigt, " +"standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn derServer nicht " +"angegeben wurde)" -#| msgid "" -#| "get nick color name (nick is first converted to lower case, following the " -#| "value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the " -#| "server is not given)" msgid "" "get nick color name, ignoring case (this calls the info " "\"nick_color_name_ignore_case\" with appropriate range, according to the " "value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the server " "is not given)" msgstr "" -"Hole den Farbnamen des Nicks, Groß- und Kleinschreibung wird ignoriert (dies" -" ruft die Funktion" -"„nick_color_name_ignore_case“ mit entsprechendem Bereich auf, dabei wird der" -" Wert des CASEMAPPING auf dem Server" -"berücksichtigt, standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn der" -"Server nicht angegeben wurde)" +"Hole den Farbnamen des Nicks, Groß- und Kleinschreibung wird ignoriert (dies " +"ruft die Funktion„nick_color_name_ignore_case“ mit entsprechendem Bereich " +"auf, dabei wird der Wert des CASEMAPPING auf dem Serverberücksichtigt, " +"standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn derServer nicht " +"angegeben wurde)" msgid "get buffer pointer for an IRC server/channel/nick" msgstr "holt Buffer Pointer für einen IRC Server/Kanal/Nick" @@ -12799,8 +12738,6 @@ msgid "%sNicks %s%s%s: %s[%s%s%s]" msgstr "%sNicks %s%s%s: %s[%s%s%s]" #. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular" -#| msgid "%s%s%d%s regular" -#| msgid_plural "%s%s%d%s regular" msgid "regular" msgid_plural "regular" msgstr[0] "regulär" @@ -13958,16 +13895,10 @@ msgstr "" msgid "get nick color name" msgstr "zeigt Farbnamen des Nick" -#| msgid "get nick color code" msgid "get nick color code, ignoring case" msgstr "" "hole Farbecode des Nick, dabei wird die Groß- und Kleinschreibung ignoriert" -#| msgid "" -#| "nickname;colors (colors is an optional comma-separated list of colors to " -#| "use; background is allowed for a color with format text:background; if " -#| "colors is present, WeeChat options with nick colors and forced nick " -#| "colors are ignored)" msgid "" "nickname;range;colors (range is a number of chars (see function " "strcasecmp_range, 0 = convert to lower case without using a range), colors " @@ -13975,16 +13906,13 @@ msgid "" "for a color with format text:background; if colors is present, WeeChat " "options with nick colors and forced nick colors are ignored)" msgstr "" -"Nickname;Bereich;Farben (Bereich ist eine Anzahl von Zeichen (siehe Funktion)." -"strcasecmp_range, 0 = in Kleinbuchstaben konvertieren, ohne einen Bereich zu" -" verwenden), Farben" -"ist eine optionale, durch Kommas getrennte Liste der zu verwendenden Farben;" -" Hintergrundfarbe kann genutzt" -"werden mit Format Text:Hintergrund; wenn Farben vorhanden sind, werden die" -" WeeChat" -"Optionen für Nick-Farben und erzwungenen Nick-Farben ignoriert)" +"Nickname;Bereich;Farben (Bereich ist eine Anzahl von Zeichen (siehe " +"Funktion).strcasecmp_range, 0 = in Kleinbuchstaben konvertieren, ohne einen " +"Bereich zu verwenden), Farbenist eine optionale, durch Kommas getrennte " +"Liste der zu verwendenden Farben; Hintergrundfarbe kann genutztwerden mit " +"Format Text:Hintergrund; wenn Farben vorhanden sind, werden die " +"WeeChatOptionen für Nick-Farben und erzwungenen Nick-Farben ignoriert)" -#| msgid "get nick color name" msgid "get nick color name, ignoring case" msgstr "" "hole Farbnamen des Nick, dabei wird die Groß- und Kleinschreibung ignoriert" @@ -16459,8 +16387,7 @@ msgstr "verwaltet Trigger, das Schweizer Armeemesser für WeeChat" msgid "" "list [-o|-ol|-i|-il] || listfull || listdefault || add|addoff|addreplace " " " -"[\"\" [\"\" [\"\" [\"\" [\"<" -"return_code>\" [\"\"]]]]]] " +"[\"\" [\"\" [\"\" [\"\" [\"\" [\"\"]]]]]] " "|| addinput [] || input|output|recreate || set