diff --git a/ChangeLog b/ChangeLog index b29ae1b27..6204aedb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.3 (under dev) +* core: add option weechat.look.tab_width * core: add completion "plugins_installed" * core: fix crash in /eval when config option has a NULL value * core: fix crash with hdata_update on shared strings, add hdata type diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt index 9bbb0f95c..61dc15a21 100644 --- a/doc/de/autogen/user/weechat_options.txt +++ b/doc/de/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** Beschreibung: `number of spaces used to display tabs in messages` +** Typ: integer +** Werte: 1 .. 64 (Standardwert: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** Beschreibung: `Format für das Datum, wenn dieses in eine Zeichenkette umgewandelt und in Nachrichten dargestellt wird (siehe man strftime, welche Platzhalter für das Datum und die Uhrzeit verwendet werden)` ** Typ: Zeichenkette diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt index df22664d3..0187fd689 100644 --- a/doc/en/autogen/user/weechat_options.txt +++ b/doc/en/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** type: string ** values: any string (default value: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** description: `number of spaces used to display tabs in messages` +** type: integer +** values: 1 .. 64 (default value: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** description: `time format for dates converted to strings and displayed in messages (see man strftime for date/time specifiers)` ** type: string diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt index 000589914..825c17f91 100644 --- a/doc/fr/autogen/user/weechat_options.txt +++ b/doc/fr/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** description: `nombre d'espaces utilisés pour afficher les tabulations dans les messages` +** type: entier +** valeurs: 1 .. 64 (valeur par défaut: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** description: `format de date/heure pour les dates converties en chaînes et affichées dans les messages (voir man strftime pour le format de date/heure)` ** type: chaîne diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt index 7a2c50a02..353321c3a 100644 --- a/doc/it/autogen/user/weechat_options.txt +++ b/doc/it/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** descrizione: `number of spaces used to display tabs in messages` +** tipo: intero +** valori: 1 .. 64 (valore predefinito: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** descrizione: `formato dell'ora per le date convertite in stringhe e mostrate nei messaggi(consultare man strftime per i dettagli su data/ora)` ** tipo: stringa diff --git a/doc/ja/autogen/user/weechat_options.txt b/doc/ja/autogen/user/weechat_options.txt index 1860c6fb3..d6232b5ac 100644 --- a/doc/ja/autogen/user/weechat_options.txt +++ b/doc/ja/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** タイプ: 文字列 ** 値: 未制約文字列 (デフォルト値: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** 説明: `number of spaces used to display tabs in messages` +** タイプ: 整数 +** 値: 1 .. 64 (デフォルト値: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** 説明: `文字列へ変換されてメッセージ中に表示される日付の時間フォーマット (日付/時間指定子は strftime の man を参照)` ** タイプ: 文字列 diff --git a/doc/pl/autogen/user/weechat_options.txt b/doc/pl/autogen/user/weechat_options.txt index 4e49e7899..6f5e060b2 100644 --- a/doc/pl/autogen/user/weechat_options.txt +++ b/doc/pl/autogen/user/weechat_options.txt @@ -838,6 +838,11 @@ ** typ: ciąg ** wartości: dowolny ciąg (domyślna wartość: `""`) +* [[option_weechat.look.tab_width]] *weechat.look.tab_width* +** opis: `number of spaces used to display tabs in messages` +** typ: liczba +** wartości: 1 .. 64 (domyślna wartość: `1`) + * [[option_weechat.look.time_format]] *weechat.look.time_format* ** opis: `format czasu dla dat, konwertowany do ciągu i wyświetlany w wiadomościach (zobacz man strftime dla specyfikatorów daty/czasu)` ** typ: ciąg diff --git a/po/cs.po b/po/cs.po index b3ce57200..80a95dd45 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3071,6 +3071,10 @@ msgstr "" "výběrem URL v některých terminálech), znaky kódované do více bytů zde NEJSOU " "povoleny" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "prefix pro zprávy akcí" + #, fuzzy msgid "" "time format for dates converted to strings and displayed in messages (see " diff --git a/po/de.po b/po/de.po index 30d9d17c9..81f55f7db 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -3567,6 +3567,11 @@ msgstr "" "Wird kein Zeichen angegeben, dann zeichnet ncurses eine durchgängige Linie. " "Die Schriftbreite muss exakt ein Zeichen betragen" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "" +"Lokalisation welche für die übersetzten Nachrichten verwendet werden soll" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/es.po b/po/es.po index 5a6ee3a9b..e64722097 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3260,6 +3260,10 @@ msgstr "" "vacío dibujará una línea verdadera con ncurses), caracteres unicode NO están " "permitidos" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "localización para traducción de mensajes" + #, fuzzy msgid "" "time format for dates converted to strings and displayed in messages (see " diff --git a/po/fr.po b/po/fr.po index 2948c26e9..697c6ce8e 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: 2014-01-14 13:17+0100\n" -"PO-Revision-Date: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" +"PO-Revision-Date: 2014-01-15 13:59+0100\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -3451,6 +3451,10 @@ msgstr "" "fenêtres (une valeur vide tracera une vraie ligne avec ncurses); la largeur " "à l'écran doit être exactement d'un caractère" +msgid "number of spaces used to display tabs in messages" +msgstr "" +"nombre d'espaces utilisés pour afficher les tabulations dans les messages" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/hu.po b/po/hu.po index 87dfce084..e9f57e3ae 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2666,6 +2666,10 @@ msgid "" "will draw a real line with ncurses); width on screen must be exactly one char" msgstr "" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "válasz ping üzenetre" + #, fuzzy msgid "" "time format for dates converted to strings and displayed in messages (see " diff --git a/po/it.po b/po/it.po index 4b1b1f26a..abdffcfd4 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -3361,6 +3361,10 @@ msgstr "" "alle finestre (un valore vuoto disegnerà una riga reale con ncurses), i " "caratteri wide qui NON sono consentiti" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "locale usato per la traduzione dei messaggi" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/ja.po b/po/ja.po index 7a01b185c..93f4f3ac8 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-13 10:55+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -3334,6 +3334,10 @@ msgstr "" "が、いくつかのターミナルでは URL 選択の際にバグを生ずる可能性がある); 必ずス" "クリーン上に描画した時の文字幅が 1 の文字を指定してください" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "翻訳メッセージに利用するロケール" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/pl.po b/po/pl.po index 19afdc1fc..697c5ddaf 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -3424,6 +3424,10 @@ msgstr "" "(pusta wartość oznacza rysowanie prawdziwych linii za pomocą ncurses); " "szerokość na ekranie musi wynosić dokładnie jeden znak" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "zestaw znaków użyty do tłumaczenia wiadomości" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 60a0329ac..7d544057a 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -3158,6 +3158,10 @@ msgstr "" "janelas(valor vazio vai desenhar uam linha real com ncurses), caracteres " "extendidos NÃO são aceitos aqui" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "prefixo para mensagens de ação" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/ru.po b/po/ru.po index fdb84c8c8..10c2fb206 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -2698,6 +2698,10 @@ msgid "" "will draw a real line with ncurses); width on screen must be exactly one char" msgstr "" +#, fuzzy +msgid "number of spaces used to display tabs in messages" +msgstr "ответить на ping" + #, fuzzy msgid "" "time format for dates converted to strings and displayed in messages (see " diff --git a/po/tr.po b/po/tr.po index 5bb5e3227..76f8bff6d 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -2408,6 +2408,9 @@ msgid "" "will draw a real line with ncurses); width on screen must be exactly one char" msgstr "" +msgid "number of spaces used to display tabs in messages" +msgstr "" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/po/weechat.pot b/po/weechat.pot index c81fb84d0..66062c749 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: 2014-01-14 13:17+0100\n" +"POT-Creation-Date: 2014-01-15 13:58+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -2410,6 +2410,9 @@ msgid "" "will draw a real line with ncurses); width on screen must be exactly one char" msgstr "" +msgid "number of spaces used to display tabs in messages" +msgstr "" + msgid "" "time format for dates converted to strings and displayed in messages (see " "man strftime for date/time specifiers)" diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 02bdc6fa4..dc41c6125 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -166,6 +166,7 @@ struct t_config_option *config_look_scroll_page_percent; struct t_config_option *config_look_search_text_not_found_alert; struct t_config_option *config_look_separator_horizontal; struct t_config_option *config_look_separator_vertical; +struct t_config_option *config_look_tab_width; struct t_config_option *config_look_time_format; struct t_config_option *config_look_window_auto_zoom; struct t_config_option *config_look_window_separator_horizontal; @@ -281,6 +282,7 @@ char ***config_highlight_tags = NULL; int config_num_highlight_tags = 0; char **config_plugin_extensions = NULL; int config_num_plugin_extensions = 0; +char config_tab_spaces[TAB_MAX_WIDTH + 1]; /* @@ -743,6 +745,23 @@ config_check_separator (void *data, struct t_config_option *option, return (utf8_strlen_screen (value) <= 1) ? 1 : 0; } +/* + * Callback for changes on option "weechat.look.tab_width". + */ + +void +config_change_tab_width (void *data, struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) option; + + memset (config_tab_spaces, ' ', CONFIG_INTEGER(config_look_tab_width)); + config_tab_spaces[CONFIG_INTEGER(config_look_tab_width)] = '\0'; + + gui_window_ask_refresh (1); +} + /* * Callback for changes on a color option. */ @@ -2608,6 +2627,12 @@ config_weechat_init_options () "width on screen must be exactly one char"), NULL, 0, 0, "", NULL, 0, &config_check_separator, NULL, &config_change_buffers, NULL, NULL, NULL); + config_look_tab_width = config_file_new_option ( + weechat_config_file, ptr_section, + "tab_width", "integer", + N_("number of spaces used to display tabs in messages"), + NULL, 1, TAB_MAX_WIDTH, "1", NULL, 0, NULL, NULL, + &config_change_tab_width, NULL, NULL, NULL); config_look_time_format = config_file_new_option ( weechat_config_file, ptr_section, "time_format", "string", @@ -3367,6 +3392,8 @@ config_weechat_init () struct tm *local_time; time_t seconds; + snprintf (config_tab_spaces, sizeof (config_tab_spaces), " "); + rc = config_weechat_init_options (); if (!rc) diff --git a/src/core/wee-config.h b/src/core/wee-config.h index eadf0706d..dc744a6dc 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -28,6 +28,8 @@ struct t_gui_buffer; #define WEECHAT_CONFIG_NAME "weechat" +#define TAB_MAX_WIDTH 64 + enum t_config_look_align_end_of_lines { CONFIG_LOOK_ALIGN_END_OF_LINES_TIME = 0, @@ -196,6 +198,7 @@ extern struct t_config_option *config_look_scroll_page_percent; extern struct t_config_option *config_look_search_text_not_found_alert; extern struct t_config_option *config_look_separator_horizontal; extern struct t_config_option *config_look_separator_vertical; +extern struct t_config_option *config_look_tab_width; extern struct t_config_option *config_look_time_format; extern struct t_config_option *config_look_window_auto_zoom; extern struct t_config_option *config_look_window_separator_horizontal; @@ -297,7 +300,7 @@ extern char ***config_highlight_tags; extern int config_num_highlight_tags; extern char **config_plugin_extensions; extern int config_num_plugin_extensions; - +extern char config_tab_spaces[]; extern struct t_config_option *config_weechat_debug_get (const char *plugin_name); extern int config_weechat_debug_set (const char *plugin_name, diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c index 2d5a8b0c4..e4d1ed3c7 100644 --- a/src/core/wee-utf8.c +++ b/src/core/wee-utf8.c @@ -397,8 +397,9 @@ utf8_strnlen (const char *string, int bytes) int utf8_strlen_screen (const char *string) { - int length, num_char; + int length, num_char, add_for_tab; wchar_t *alloc_wstring, *ptr_wstring, wstring[4+2]; + const char *ptr_string; if (!string || !string[0]) return 0; @@ -440,6 +441,16 @@ utf8_strlen_screen (const char *string) if (alloc_wstring) free (alloc_wstring); + add_for_tab = CONFIG_INTEGER(config_look_tab_width) - 1; + if (add_for_tab > 0) + { + for (ptr_string = string; ptr_string[0]; ptr_string++) + { + if (ptr_string[0] == '\t') + length += add_for_tab; + } + } + return length; } diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 430e62d6b..43a37a208 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -371,7 +371,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line, int apply_style_inactive, int nick_offline) { - char *next_char, *output, utf_char[16]; + char *next_char, *output, utf_char[16], *ptr_char; int x, chars_displayed, display_char, size_on_screen; if (!simulate) @@ -396,15 +396,20 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line, next_char = utf8_next_char (string); if (next_char) { + ptr_char = utf_char; + memcpy (utf_char, string, next_char - string); utf_char[next_char - string] = '\0'; + if (!gui_chat_utf_char_valid (utf_char)) snprintf (utf_char, sizeof (utf_char), " "); + else if (utf_char[0] == '\t') + ptr_char = config_tab_spaces; display_char = (window->buffer->type != GUI_BUFFER_TYPE_FREE) || (x >= window->scroll->start_col); - size_on_screen = utf8_strlen_screen (utf_char); + size_on_screen = utf8_strlen_screen (ptr_char); if ((max_chars_on_screen > 0) && (chars_displayed + size_on_screen > max_chars_on_screen)) { @@ -414,9 +419,9 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line, { if (!simulate) { - output = string_iconv_from_internal (NULL, utf_char); + output = string_iconv_from_internal (NULL, ptr_char); waddstr (GUI_WINDOW_OBJECTS(window)->win_chat, - (output) ? output : utf_char); + (output) ? output : ptr_char); if (output) free (output); diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index b215a90ed..335e7c5cc 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -138,8 +138,8 @@ gui_chat_prefix_build () int gui_chat_utf_char_valid (const char *utf_char) { - /* chars below 32 are not valid */ - if ((unsigned char)utf_char[0] < 32) + /* chars below 32 are not valid (except TAB) */ + if (((unsigned char)utf_char[0] < 32) && (utf_char[0] != '\t')) return 0; /* 146 or 0x7F are not valid */