1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 11:13:12 +02:00

core: add new options weechat.look.bar_more_left/right/up/down

This commit is contained in:
Sebastien Helleu
2011-08-26 23:42:46 +02:00
parent 8cc9b3ced6
commit ce0a81fe20
18 changed files with 378 additions and 39 deletions
+29 -1
View File
@@ -79,6 +79,10 @@ struct t_config_option *config_startup_display_version;
/* config, look & feel section */
struct t_config_option *config_look_align_end_of_lines;
struct t_config_option *config_look_bar_more_left;
struct t_config_option *config_look_bar_more_right;
struct t_config_option *config_look_bar_more_up;
struct t_config_option *config_look_bar_more_down;
struct t_config_option *config_look_buffer_notify_default;
struct t_config_option *config_look_buffer_time_format;
struct t_config_option *config_look_color_pairs_auto_reset;
@@ -1598,6 +1602,30 @@ config_weechat_init_options ()
"are starting under this data (time, buffer, prefix, suffix, "
"message (default))"),
"time|buffer|prefix|suffix|message", 0, 0, "message", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_bar_more_left = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more_left", "string",
N_("string displayed when bar can be scrolled to the left "
"(for bars with filling \"horizontal\")"),
NULL, 0, 0, "<<", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_bar_more_right = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more_right", "string",
N_("string displayed when bar can be scrolled to the right "
"(for bars with filling \"horizontal\")"),
NULL, 0, 0, ">>", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_bar_more_up = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more_up", "string",
N_("string displayed when bar can be scrolled up "
"(for bars with filling different from \"horizontal\")"),
NULL, 0, 0, "--", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_bar_more_down = config_file_new_option (
weechat_config_file, ptr_section,
"bar_more_down", "string",
N_("string displayed when bar can be scrolled down "
"(for bars with filling different from \"horizontal\")"),
NULL, 0, 0, "++", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_buffer_notify_default = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_notify_default", "integer",
@@ -1789,7 +1817,7 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"item_buffer_filter", "string",
N_("string used to show that some lines are filtered in current buffer "
"(bar item \"buffer_filter\""),
"(bar item \"buffer_filter\")"),
NULL, 0, 0, "*", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_jump_current_to_previous_buffer = config_file_new_option (
weechat_config_file, ptr_section,
+4
View File
@@ -104,6 +104,10 @@ extern struct t_config_option *config_startup_display_logo;
extern struct t_config_option *config_startup_display_version;
extern struct t_config_option *config_look_align_end_of_lines;
extern struct t_config_option *config_look_bar_more_left;
extern struct t_config_option *config_look_bar_more_right;
extern struct t_config_option *config_look_bar_more_up;
extern struct t_config_option *config_look_bar_more_down;
extern struct t_config_option *config_look_buffer_notify_default;
extern struct t_config_option *config_look_buffer_time_format;
extern struct t_config_option *config_look_command_chars;
+32 -14
View File
@@ -385,7 +385,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
static char str_start_input_hidden[16] = { '\0' };
static char str_cursor[16] = { '\0' };
char *pos_start_input, *pos_after_start_input, *pos_cursor, *buf;
char *new_start_input;
char *new_start_input, *ptr_string;
static int length_start_input, length_start_input_hidden;
int length_on_screen;
int chars_available, index, size;
@@ -646,28 +646,46 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
if ((bar_window->cursor_x < 0) && (bar_window->cursor_y < 0)
&& ((bar_window->scroll_x > 0) || (bar_window->scroll_y > 0)))
{
x = (bar_window->height > 1) ? bar_window->width - 2 : 0;
if (x < 0)
if (filling == GUI_BAR_FILLING_HORIZONTAL)
{
ptr_string = CONFIG_STRING(config_look_bar_more_left);
x = 0;
}
else
{
ptr_string = CONFIG_STRING(config_look_bar_more_up);
x = bar_window->width - utf8_strlen_screen (ptr_string);
if (x < 0)
x = 0;
}
y = 0;
gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
CONFIG_COLOR(config_color_bar_more),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
mvwprintw (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
y, x, "--");
if (ptr_string && ptr_string[0])
{
gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
CONFIG_COLOR(config_color_bar_more),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
mvwprintw (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
y, x, ptr_string);
}
}
if ((bar_window->cursor_x < 0) && (bar_window->cursor_y < 0)
&& (some_data_not_displayed || (line < items_count)))
{
x = bar_window->width - 2;
ptr_string = (filling == GUI_BAR_FILLING_HORIZONTAL) ?
CONFIG_STRING(config_look_bar_more_right) :
CONFIG_STRING(config_look_bar_more_down);
x = bar_window->width - utf8_strlen_screen (ptr_string);
if (x < 0)
x = 0;
y = (bar_window->height > 1) ? bar_window->height - 1 : 0;
gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
CONFIG_COLOR(config_color_bar_more),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
mvwprintw (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
y, x, "++");
if (ptr_string && ptr_string[0])
{
gui_window_set_custom_color_fg_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
CONFIG_COLOR(config_color_bar_more),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
mvwprintw (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
y, x, ptr_string);
}
}
}
if (items)