From 8cd4bf3750fb7206aca2bf850c203ea55ac3091a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 27 Jul 2013 23:23:15 +0200 Subject: [PATCH] core: add option "-o" for command /color --- ChangeLog | 1 + po/cs.po | 6 ++++-- po/de.po | 7 +++++-- po/es.po | 7 +++++-- po/fr.po | 11 +++++++---- po/hu.po | 5 +++-- po/it.po | 7 +++++-- po/ja.po | 7 +++++-- po/pl.po | 7 +++++-- po/pt_BR.po | 7 +++++-- po/ru.po | 5 +++-- po/tr.po | 6 ++++-- po/weechat.pot | 5 +++-- src/core/wee-command.c | 18 +++++++++++++++--- src/gui/curses/gui-curses-color.c | 26 +++++++++++++++++++------- src/gui/gui-color.h | 1 + 16 files changed, 90 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58762525c..da154c6cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] Version 0.4.2 (under dev!) -------------------------- +* core: add option "-o" for command /color * core: fix priority of logical operators in evaluation of expression (AND takes precedence over the OR) * core: remove gap after read marker line when there is no bar on the right diff --git a/po/cs.po b/po/cs.po index 3dc0f7456..77e47c319 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1094,7 +1094,8 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "definuje alias barvy a zobrazí paletu barev" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" #, fuzzy @@ -1107,6 +1108,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/de.po b/po/de.po index b5f38b133..ee92a9012 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -1110,9 +1110,11 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "definiert Farbaliase und stellt eine Palette der möglichen Farben dar" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1122,6 +1124,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/es.po b/po/es.po index b58eab4de..4df009a53 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -1102,9 +1102,11 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "define alias de colores y muestra la paleta de colores" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1114,6 +1116,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/fr.po b/po/fr.po index 2dae8832c..bbd2d64da 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-07-27 20:24+0200\n" -"PO-Revision-Date: 2013-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" +"PO-Revision-Date: 2013-07-27 23:19+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -1098,8 +1098,8 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "définir des alias de couleurs et afficher la palette des couleurs" -msgid "alias || unalias || reset" -msgstr "alias || unalias || reset" +msgid "alias || unalias || reset || -o" +msgstr "alias || unalias || reset || -o" msgid "" " alias: add an alias for a color\n" @@ -1110,6 +1110,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" @@ -1127,6 +1128,8 @@ msgstr "" " reset: réinitialiser toutes les paires de couleurs (requis quand il n'y a " "plus de paires de couleurs disponibles si la réinitialisation automatique " "est désactivée, voir l'option weechat.look.color_pairs_auto_reset)\n" +" -o: envoyer les infos terminal/couleurs sur le tampon courant comme " +"entrée\n" "\n" "Sans paramètre, cette commande affiche les couleurs dans un nouveau tampon.\n" "\n" diff --git a/po/hu.po b/po/hu.po index b7ddc5d3a..6db0a9095 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1050,7 +1050,7 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "" -msgid "alias || unalias || reset" +msgid "alias || unalias || reset || -o" msgstr "" msgid "" @@ -1062,6 +1062,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/it.po b/po/it.po index bcf43d171..3efe75f09 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -1087,9 +1087,11 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "definisce gli alias dei colori e visualizza la tavolozza dei colori" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1099,6 +1101,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/ja.po b/po/ja.po index 76c610377..dacc09a56 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -1076,9 +1076,11 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "色の別名の定義と、カラーパレットの表示" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1088,6 +1090,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/pl.po b/po/pl.po index 5e532c1fc..c1b64efae 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -1102,9 +1102,11 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "definiuje aliasy i wyświetla paletę kolorów" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1114,6 +1116,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 8ffddbe93..577ec4079 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:51+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -1131,11 +1131,13 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "define apelidos para cores e mostra a palheta de cores" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" # Translate orange? Is it a internal name? # TODO: revisit here when color names were specified as translatable or not +#, fuzzy msgid "" " alias: add an alias for a color\n" "unalias: delete an alias\n" @@ -1145,6 +1147,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/ru.po b/po/ru.po index df1648b19..3308fc970 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:52+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1070,7 +1070,7 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "" -msgid "alias || unalias || reset" +msgid "alias || unalias || reset || -o" msgstr "" msgid "" @@ -1082,6 +1082,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/tr.po b/po/tr.po index a8305706c..2ca08075f 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-07-18 19:52+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -925,7 +925,8 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "" -msgid "alias || unalias || reset" +#, fuzzy +msgid "alias || unalias || reset || -o" msgstr "alias || unalias || reset" msgid "" @@ -937,6 +938,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/po/weechat.pot b/po/weechat.pot index 39d7ddc31..fe46f309a 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-07-27 20:24+0200\n" +"POT-Creation-Date: 2013-07-27 23:18+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -934,7 +934,7 @@ msgstr "" msgid "define color aliases and display palette of colors" msgstr "" -msgid "alias || unalias || reset" +msgid "alias || unalias || reset || -o" msgstr "" msgid "" @@ -946,6 +946,7 @@ msgid "" " reset: reset all color pairs (required when no more color pairs are " "available if automatic reset is disabled, see option weechat.look." "color_pairs_auto_reset)\n" +" -o: send terminal/colors info to current buffer as input\n" "\n" "Without argument, this command displays colors in a new buffer.\n" "\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 9c2ba6a88..c5f88cbca 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1054,6 +1054,14 @@ COMMAND_CALLBACK(color) return WEECHAT_RC_OK; } + /* send terminal/colors info to buffer */ + if (string_strcasecmp (argv[1], "-o") == 0) + { + gui_color_info_term_colors (str_color, sizeof (str_color)); + input_data (buffer, str_color); + return WEECHAT_RC_OK; + } + /* add a color alias */ if (string_strcasecmp (argv[1], "alias") == 0) { @@ -6026,7 +6034,8 @@ command_init () N_("define color aliases and display palette of colors"), N_("alias " " || unalias " - " || reset"), + " || reset" + " || -o"), N_(" alias: add an alias for a color\n" "unalias: delete an alias\n" " color: color number (greater than or equal to 0, max " @@ -6034,7 +6043,9 @@ command_init () " name: alias name for color (for example: \"orange\")\n" " reset: reset all color pairs (required when no more " "color pairs are available if automatic reset is disabled, " - "see option weechat.look.color_pairs_auto_reset)\n\n" + "see option weechat.look.color_pairs_auto_reset)\n" + " -o: send terminal/colors info to current buffer as " + "input\n\n" "Without argument, this command displays colors in a new " "buffer.\n\n" "Examples:\n" @@ -6044,7 +6055,8 @@ command_init () " /color unalias 214"), "alias %(palette_colors)" " || unalias %(palette_colors)" - " || reset", + " || reset" + " || -o", &command_color, NULL); /* * give high priority (50000) so that an alias will not take precedence diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index 4e7843f42..8081347fa 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -748,6 +748,23 @@ gui_color_buffer_display_timer () } } +/* + * Put info about terminal and colors in buffer: $TERM, COLORS, COLOR_PAIRS, + * can_change_color. + */ + +void +gui_color_info_term_colors (char *buffer, int size) +{ + snprintf (buffer, size, + "$TERM=%s COLORS: %d, COLOR_PAIRS: %d, " + "can_change_color: %s", + getenv ("TERM"), + gui_color_term_colors, + gui_color_term_color_pairs, + (gui_color_term_can_change_color) ? "yes" : "no"); +} + /* * Displays content of color buffer. */ @@ -774,13 +791,8 @@ gui_color_buffer_display () /* display terminal/colors infos */ y = 0; - gui_chat_printf_y (gui_color_buffer, y++, - "$TERM=%s COLORS: %d, COLOR_PAIRS: %d, " - "can_change_color: %s", - getenv ("TERM"), - gui_color_term_colors, - gui_color_term_color_pairs, - (gui_color_term_can_change_color) ? "yes" : "no"); + gui_color_info_term_colors (str_line, sizeof (str_line)); + gui_chat_printf_y (gui_color_buffer, y++, "%s", str_line); /* display palette of colors */ y++; diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index 7aa539902..47c2aae88 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -185,6 +185,7 @@ extern int gui_color_get_term_colors (); extern const char *gui_color_get_name (int num_color); extern void gui_color_init_weechat (); extern void gui_color_display_terminal_colors (); +extern void gui_color_info_term_colors (char *buffer, int size); extern void gui_color_buffer_display (); extern void gui_color_switch_colors (); extern void gui_color_reset_pairs ();