mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 11:43:13 +02:00
core: convert options weechat.look.prefix_align_more and weechat.look.prefix_buffer_align_more from boolean to string (task #11197)
This commit is contained in:
+44
-7
@@ -42,6 +42,7 @@
|
||||
#include "wee-hook.h"
|
||||
#include "wee-log.h"
|
||||
#include "wee-network.h"
|
||||
#include "wee-utf8.h"
|
||||
#include "wee-util.h"
|
||||
#include "wee-list.h"
|
||||
#include "wee-proxy.h"
|
||||
@@ -564,6 +565,39 @@ config_change_prefix_align_min (void *data, struct t_config_option *option)
|
||||
gui_window_ask_refresh (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_check_prefix_align_more: check string "prefix align more" (must be
|
||||
* max one char wide on screen)
|
||||
*/
|
||||
|
||||
int
|
||||
config_check_prefix_align_more (void *data, struct t_config_option *option,
|
||||
const char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
return (utf8_strlen_screen (value) == 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_check_prefix_buffer_align_more: check string "prefix buffer align more"
|
||||
* (must be max one char wide on screen)
|
||||
*/
|
||||
|
||||
int
|
||||
config_check_prefix_buffer_align_more (void *data,
|
||||
struct t_config_option *option,
|
||||
const char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
return (utf8_strlen_screen (value) == 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_color: called when a color is changed by /set command
|
||||
*/
|
||||
@@ -2069,9 +2103,11 @@ config_weechat_init_options ()
|
||||
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",
|
||||
N_("display '+' if prefix is truncated"),
|
||||
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
"prefix_align_more", "string",
|
||||
N_("char to display if prefix is truncated (must be exactly one char "
|
||||
"on screen)"),
|
||||
NULL, 0, 0, "+", NULL, 0,
|
||||
&config_check_prefix_align_more, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_prefix_buffer_align = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_buffer_align", "integer",
|
||||
@@ -2086,10 +2122,11 @@ config_weechat_init_options ()
|
||||
NULL, 0, 128, "0", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_prefix_buffer_align_more = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_buffer_align_more", "boolean",
|
||||
N_("display '+' if buffer name is truncated (when many buffers are "
|
||||
"merged with same number)"),
|
||||
NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
"prefix_buffer_align_more", "string",
|
||||
N_("char to display if buffer name is truncated (when many buffers are "
|
||||
"merged with same number) (must be exactly one char on screen)"),
|
||||
NULL, 0, 0, "+", NULL, 0,
|
||||
&config_check_prefix_buffer_align_more, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_prefix_same_nick = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_same_nick", "string",
|
||||
|
||||
@@ -574,7 +574,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
|
||||
int *lines_displayed,
|
||||
int simulate)
|
||||
{
|
||||
char str_space[] = " ", str_plus[] = "+";
|
||||
char str_space[] = " ";
|
||||
char *prefix_no_color, *prefix_highlighted, *ptr_prefix, *ptr_prefix2;
|
||||
char *ptr_prefix_color;
|
||||
const char *short_name, *str_color;
|
||||
@@ -702,8 +702,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
|
||||
GUI_COLOR_CHAT_PREFIX_MORE);
|
||||
}
|
||||
gui_chat_display_word (window, line,
|
||||
(CONFIG_BOOLEAN(config_look_prefix_buffer_align_more)) ?
|
||||
str_plus : str_space,
|
||||
CONFIG_STRING(config_look_prefix_buffer_align_more),
|
||||
NULL, 1, num_lines, count, lines_displayed,
|
||||
simulate,
|
||||
CONFIG_BOOLEAN(config_look_color_inactive_prefix_buffer));
|
||||
@@ -903,8 +902,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
|
||||
GUI_COLOR_CHAT_PREFIX_MORE);
|
||||
}
|
||||
gui_chat_display_word (window, line,
|
||||
(CONFIG_BOOLEAN(config_look_prefix_align_more)) ?
|
||||
str_plus : str_space,
|
||||
CONFIG_STRING(config_look_prefix_align_more),
|
||||
NULL, 1, num_lines, count, lines_displayed,
|
||||
simulate,
|
||||
CONFIG_BOOLEAN(config_look_color_inactive_prefix));
|
||||
|
||||
Reference in New Issue
Block a user