diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-02 00:29:19 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-02 00:29:19 +0200 |
commit | 9605a8726f09e0c5648683c3f17f77facfaa0857 (patch) | |
tree | cf622abb6cb82e55aff7b32633fbf88ec7e44d2d /src | |
parent | 5ef4ecb5ab97bd763c396af749ddc9410e6516f6 (diff) | |
download | weechat-9605a8726f09e0c5648683c3f17f77facfaa0857.zip |
Add new option weechat.look.prefix_align_min (task #10650)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config.c | 31 | ||||
-rw-r--r-- | src/core/wee-config.h | 1 | ||||
-rw-r--r-- | src/gui/gui-filter.c | 3 | ||||
-rw-r--r-- | src/gui/gui-line.c | 4 |
4 files changed, 36 insertions, 3 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c index d1e4504b0..720f926a3 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -52,6 +52,7 @@ #include "../gui/gui-hotlist.h" #include "../gui/gui-keyboard.h" #include "../gui/gui-layout.h" +#include "../gui/gui-line.h" #include "../gui/gui-nicklist.h" #include "../gui/gui-window.h" #include "../plugins/plugin.h" @@ -101,6 +102,7 @@ struct t_config_option *config_look_paste_max_lines; struct t_config_option *config_look_prefix[GUI_CHAT_NUM_PREFIXES]; struct t_config_option *config_look_prefix_align; struct t_config_option *config_look_prefix_align_max; +struct t_config_option *config_look_prefix_align_min; struct t_config_option *config_look_prefix_align_more; struct t_config_option *config_look_prefix_buffer_align; struct t_config_option *config_look_prefix_buffer_align_max; @@ -322,6 +324,30 @@ config_change_prefix (void *data, struct t_config_option *option) } /* + * config_change_prefix_align_min: called when prefix_align_min is changed + */ + +void +config_change_prefix_align_min (void *data, struct t_config_option *option) +{ + struct t_gui_buffer *ptr_buffer; + + /* make C compiler happy */ + (void) data; + (void) option; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + if (ptr_buffer->own_lines) + gui_line_compute_prefix_max_length (ptr_buffer->own_lines); + if (ptr_buffer->mixed_lines) + gui_line_compute_prefix_max_length (ptr_buffer->mixed_lines); + } + gui_window_refresh_windows (); +} + +/* * config_change_color: called when a color is changed by /set command */ @@ -1434,6 +1460,11 @@ config_weechat_init_options () "prefix_align_max", "integer", N_("max size for prefix (0 = no max size)"), NULL, 0, 128, "0", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + config_look_prefix_align_min = config_file_new_option ( + weechat_config_file, ptr_section, + "prefix_align_min", "integer", + N_("min size for prefix"), + NULL, 0, 128, "0", NULL, 0, NULL, NULL, &config_change_prefix_align_min, NULL, NULL, NULL); config_look_prefix_align_more = config_file_new_option ( weechat_config_file, ptr_section, "prefix_align_more", "boolean", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 362f1c3c5..70b872648 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -131,6 +131,7 @@ extern struct t_config_option *config_look_paste_max_lines; extern struct t_config_option *config_look_prefix[]; extern struct t_config_option *config_look_prefix_align; extern struct t_config_option *config_look_prefix_align_max; +extern struct t_config_option *config_look_prefix_align_min; extern struct t_config_option *config_look_prefix_align_more; extern struct t_config_option *config_look_prefix_buffer_align; extern struct t_config_option *config_look_prefix_buffer_align_max; diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index 8ad74154c..066bac38c 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -30,6 +30,7 @@ #include <regex.h> #include "../core/weechat.h" +#include "../core/wee-config.h" #include "../core/wee-hook.h" #include "../core/wee-infolist.h" #include "../core/wee-log.h" @@ -138,7 +139,7 @@ gui_filter_buffer (struct t_gui_buffer *buffer) lines_hidden = 0; - buffer->lines->prefix_max_length = 0; + buffer->lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min); for (ptr_line = buffer->lines->first_line; ptr_line; ptr_line = ptr_line->next_line) diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index d770926d3..3aa4b695c 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -63,7 +63,7 @@ gui_lines_alloc () new_lines->first_line_not_read = 0; new_lines->lines_hidden = 0; new_lines->buffer_max_length = 0; - new_lines->prefix_max_length = 0; + new_lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min); } return new_lines; @@ -483,7 +483,7 @@ gui_line_compute_prefix_max_length (struct t_gui_lines *lines) { struct t_gui_line *ptr_line; - lines->prefix_max_length = 0; + lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min); for (ptr_line = lines->first_line; ptr_line; ptr_line = ptr_line->next_line) { |