1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 01:03:14 +02:00

core: add option weechat.look.tab_width

This commit is contained in:
Sebastien Helleu
2014-01-15 15:10:54 +01:00
parent 70ffe0a14f
commit 4b7e90c679
24 changed files with 145 additions and 21 deletions
+1
View File
@@ -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
+5
View File
@@ -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
+5
View File
@@ -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
+5
View File
@@ -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
+5
View File
@@ -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
+5
View File
@@ -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 を参照)`
** タイプ: 文字列
+5
View File
@@ -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
+5 -1
View File
@@ -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 <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "
+6 -1
View File
@@ -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 <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\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)"
+5 -1
View File
@@ -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 <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "
+6 -2
View File
@@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "
+5 -1
View File
@@ -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 <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\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)"
+5 -1
View File
@@ -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 <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "
+4 -1
View File
@@ -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 <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+4 -1
View File
@@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+27
View File
@@ -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)
+4 -1
View File
@@ -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,
+12 -1
View File
@@ -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;
}
+9 -4
View File
@@ -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);
+2 -2
View File
@@ -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 */