diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index b28668f0e..1111ed45d 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -19,6 +19,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] === New features +* core: add completion "colors" (issue #481) * core: start/stop search in buffer at current scroll position by default, add key key[ctrl-q] to stop search and reset scroll (issue #76, issue #393) * core: add option weechat.look.key_grab_delay to set the default delay when diff --git a/doc/de/autogen/plugin_api/completions.asciidoc b/doc/de/autogen/plugin_api/completions.asciidoc index 1367ca136..944ebc983 100644 --- a/doc/de/autogen/plugin_api/completions.asciidoc +++ b/doc/de/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | Liste der Buffer (inklusive der Erweiterungen) +| weechat | colors | color names + | weechat | commands | Befehle (WeeChat und Erweiterungen) | weechat | config_files | Konfigurationsdateien diff --git a/doc/en/autogen/plugin_api/completions.asciidoc b/doc/en/autogen/plugin_api/completions.asciidoc index 43e1faca6..157b6ac14 100644 --- a/doc/en/autogen/plugin_api/completions.asciidoc +++ b/doc/en/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | names of buffers (including plugins names) +| weechat | colors | color names + | weechat | commands | commands (weechat and plugins) | weechat | config_files | configuration files diff --git a/doc/fr/autogen/plugin_api/completions.asciidoc b/doc/fr/autogen/plugin_api/completions.asciidoc index f087f1d87..e50200185 100644 --- a/doc/fr/autogen/plugin_api/completions.asciidoc +++ b/doc/fr/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | noms des tampons (incluant les noms d'extensions) +| weechat | colors | noms des couleurs + | weechat | commands | commandes (weechat et extensions) | weechat | config_files | fichiers de configuration diff --git a/doc/it/autogen/plugin_api/completions.asciidoc b/doc/it/autogen/plugin_api/completions.asciidoc index 5b55cdff4..b735f5ad7 100644 --- a/doc/it/autogen/plugin_api/completions.asciidoc +++ b/doc/it/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | nomi dei buffer (inclusi i nomi dei plugin) +| weechat | colors | color names + | weechat | commands | comandi (weechat e plugin) | weechat | config_files | file di configurazione diff --git a/doc/ja/autogen/plugin_api/completions.asciidoc b/doc/ja/autogen/plugin_api/completions.asciidoc index 3136e4de9..f1d1d8f5f 100644 --- a/doc/ja/autogen/plugin_api/completions.asciidoc +++ b/doc/ja/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | バッファの名前 (プラグインの名前を含めた) +| weechat | colors | color names + | weechat | commands | コマンド (weechat とプラグイン) | weechat | config_files | 設定ファイル diff --git a/doc/pl/autogen/plugin_api/completions.asciidoc b/doc/pl/autogen/plugin_api/completions.asciidoc index f96ac24c4..08abc1b49 100644 --- a/doc/pl/autogen/plugin_api/completions.asciidoc +++ b/doc/pl/autogen/plugin_api/completions.asciidoc @@ -112,6 +112,8 @@ | weechat | buffers_plugins_names | nazwy buforów (włącznie z nazwami wtyczek) +| weechat | colors | color names + | weechat | commands | komendy (weechata i wtyczek) | weechat | config_files | pliki konfiguracyjne diff --git a/po/cs.po b/po/cs.po index d3fb24527..4479726db 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-08-01 10:23+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -2642,6 +2642,10 @@ msgstr "vlastnosti, které mohou být čteny o bufferu" msgid "numbers of windows" msgstr "seznam oken" +#, fuzzy +msgid "color names" +msgstr "získat jméno barvy přezdívky" + msgid "palette colors" msgstr "barvy palety" diff --git a/po/de.po b/po/de.po index 0300cfcd0..2c121a763 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-08-08 10:29+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German <>\n" @@ -3115,6 +3115,10 @@ msgstr "Eigenschaften die für den Buffer gelesen werden können" msgid "numbers of windows" msgstr "Nummern der Fenster" +#, fuzzy +msgid "color names" +msgstr "zeigt Farbnamen des Nick" + msgid "palette colors" msgstr "Farbpalette" diff --git a/po/es.po b/po/es.po index c5c2a54dd..b37f41e2a 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:41+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -2768,6 +2768,10 @@ msgstr "propiedades del buffer que pueden leerse" msgid "numbers of windows" msgstr "números de ventanas" +#, fuzzy +msgid "color names" +msgstr "obtiene el nombre del color del apodo" + msgid "palette colors" msgstr "paleta de colores" diff --git a/po/fr.po b/po/fr.po index cfeddc246..187035d60 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" -"PO-Revision-Date: 2015-08-08 10:29+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" +"PO-Revision-Date: 2015-08-11 22:24+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -3040,6 +3040,9 @@ msgstr "propriétés qui peuvent être lues sur un tampon" msgid "numbers of windows" msgstr "numéros des fenêtres" +msgid "color names" +msgstr "noms des couleurs" + msgid "palette colors" msgstr "couleurs de la palette" diff --git a/po/hu.po b/po/hu.po index 625c31633..f6137e65b 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:42+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2290,6 +2290,10 @@ msgstr "puffer betöltése sikertelen" msgid "numbers of windows" msgstr "Mellőzések listája:\n" +#, fuzzy +msgid "color names" +msgstr "üzenetek színe" + #, fuzzy msgid "palette colors" msgstr "Alapértelmezett billentyűparancsok visszaállítva\n" diff --git a/po/it.po b/po/it.po index 998230e59..265c9ab76 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:42+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -2857,6 +2857,10 @@ msgstr "proprietà che possono essere lette su un buffer" msgid "numbers of windows" msgstr "numeri delle finestre" +#, fuzzy +msgid "color names" +msgstr "ottiene il nome del colore del nick" + msgid "palette colors" msgstr "Tavolozza dei colori" diff --git a/po/ja.po b/po/ja.po index 4937d3311..b618bd413 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-08-10 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -2958,6 +2958,10 @@ msgstr "バッファから読み取り可能なプロパティ" msgid "numbers of windows" msgstr "ウィンドウの数" +#, fuzzy +msgid "color names" +msgstr "ニックネームの色名を取得" + msgid "palette colors" msgstr "パレットカラー" diff --git a/po/pl.po b/po/pl.po index 27ac8b256..dadb88f23 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:42+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -3007,6 +3007,10 @@ msgstr "właściwości, jakie mogą być przeczytane w buforze" msgid "numbers of windows" msgstr "liczba okien" +#, fuzzy +msgid "color names" +msgstr "pobiera nazwę koloru nicka" + msgid "palette colors" msgstr "paleta kolorów" diff --git a/po/pt_BR.po b/po/pt_BR.po index fbed39426..dfa5a22b9 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:42+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -2823,6 +2823,10 @@ msgstr "propriedades que podem ser lidas em um buffer" msgid "numbers of windows" msgstr "número de janelas" +#, fuzzy +msgid "color names" +msgstr "obter nome da cor do apelido" + msgid "palette colors" msgstr "cores da palheta" diff --git a/po/ru.po b/po/ru.po index 563766cf8..eeaa64984 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-07-26 09:42+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -2313,6 +2313,10 @@ msgstr "загрузка буфера не удалась" msgid "numbers of windows" msgstr "Список игнорирования:\n" +#, fuzzy +msgid "color names" +msgstr "цвет чата" + #, fuzzy msgid "palette colors" msgstr "Комбинации клавиш по умолчанию восстановлены\n" diff --git a/po/tr.po b/po/tr.po index a2cc23251..372038eea 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2015-03-10 21:33+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -2075,6 +2075,10 @@ msgstr "" msgid "numbers of windows" msgstr "" +#, fuzzy +msgid "color names" +msgstr "rumuz renk ismi al" + msgid "palette colors" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 5c7ac24a7..7aa219368 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-08-08 10:28+0200\n" +"POT-Creation-Date: 2015-08-11 22:24+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -2073,6 +2073,9 @@ msgstr "" msgid "numbers of windows" msgstr "" +msgid "color names" +msgstr "" + msgid "palette colors" msgstr "" diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c index c3276364e..489b5fecf 100644 --- a/src/core/wee-completion.c +++ b/src/core/wee-completion.c @@ -288,6 +288,62 @@ completion_list_add_windows_numbers_cb (void *data, return WEECHAT_RC_OK; } +/* + * Adds colors to completion list. + */ + +int +completion_list_add_colors_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + char str_number[64]; + const char *color_name; + int i, num_colors; + struct t_gui_color_palette *color_palette; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + num_colors = gui_color_get_weechat_colors_number (); + for (i = 0; i < num_colors; i++) + { + color_name = gui_color_get_name (i); + if (color_name) + { + gui_completion_list_add (completion, + color_name, + 0, WEECHAT_LIST_POS_SORT); + } + } + num_colors = gui_color_get_term_colors (); + for (i = 0; i <= num_colors; i++) + { + color_palette = gui_color_palette_get (i); + if (color_palette) + { + gui_completion_list_add (completion, + color_palette->alias, + 0, WEECHAT_LIST_POS_END); + } + else + { + snprintf (str_number, + sizeof (str_number), + "%d", + i); + gui_completion_list_add (completion, + str_number, + 0, WEECHAT_LIST_POS_END); + } + } + + return WEECHAT_RC_OK; +} + /* * Adds a palette color to completion list. */ @@ -901,13 +957,12 @@ completion_list_add_config_option_values_cb (void *data, struct t_gui_completion *completion) { char *pos_space, *option_full_name, *pos_section, *pos_option; - char *file, *section, *value_string, str_number[64]; + char *file, *section, *value_string; const char *color_name; - int length, i, num_colors; + int length, i; struct t_config_file *ptr_config; struct t_config_section *ptr_section, *section_found; struct t_config_option *option_found; - struct t_gui_color_palette *color_palette; /* make C compiler happy */ (void) data; @@ -1066,38 +1121,8 @@ completion_list_add_config_option_values_cb (void *data, } break; case CONFIG_OPTION_TYPE_COLOR: - num_colors = gui_color_get_weechat_colors_number (); - for (i = 0; i < num_colors; i++) - { - color_name = gui_color_get_name (i); - if (color_name) - { - gui_completion_list_add (completion, - color_name, - 0, WEECHAT_LIST_POS_SORT); - } - } - num_colors = gui_color_get_term_colors (); - for (i = 0; i <= num_colors; i++) - { - color_palette = gui_color_palette_get (i); - if (color_palette) - { - gui_completion_list_add (completion, - color_palette->alias, - 0, WEECHAT_LIST_POS_END); - } - else - { - snprintf (str_number, - sizeof (str_number), - "%d", - i); - gui_completion_list_add (completion, - str_number, - 0, WEECHAT_LIST_POS_END); - } - } + completion_list_add_colors_cb ( + data, completion_item, buffer, completion); gui_completion_list_add (completion, "++1", 0, WEECHAT_LIST_POS_END); gui_completion_list_add (completion, "--1", @@ -1565,6 +1590,9 @@ completion_init () hook_completion (NULL, "windows_numbers", N_("numbers of windows"), &completion_list_add_windows_numbers_cb, NULL); + hook_completion (NULL, "colors", + N_("color names"), + &completion_list_add_colors_cb, NULL); hook_completion (NULL, "palette_colors", N_("palette colors"), &completion_list_add_palette_colors_cb, NULL);