mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Add missing space at beginning of bar item when first sub-item content is NULL
This commit is contained in:
@@ -348,9 +348,9 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
int x, y, items_count, num_lines, line;
|
||||
enum t_gui_bar_filling filling;
|
||||
char *content, **items;
|
||||
char space_with_reinit_color[32], str_start_input[16], str_cursor[16];
|
||||
char str_start_input[16], str_cursor[16];
|
||||
char *pos_start_input, *pos_cursor, *buf, *new_start_input;
|
||||
int length_reinit_color, length_on_screen, chars_available;
|
||||
int length_on_screen, chars_available;
|
||||
int length_screen_before_cursor, length_screen_after_cursor;
|
||||
int total_length_screen, diff, max_length, optimal_number_of_lines;
|
||||
int some_data_not_displayed;
|
||||
@@ -358,15 +358,6 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
|
||||
if (!gui_init_ok)
|
||||
return;
|
||||
|
||||
snprintf (space_with_reinit_color,
|
||||
sizeof (space_with_reinit_color),
|
||||
"%c%c%02d,%02d ",
|
||||
GUI_COLOR_COLOR_CHAR,
|
||||
GUI_COLOR_FG_BG_CHAR,
|
||||
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]),
|
||||
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
|
||||
length_reinit_color = strlen (space_with_reinit_color);
|
||||
|
||||
snprintf (str_start_input, sizeof (str_start_input), "%c%c%c",
|
||||
GUI_COLOR_COLOR_CHAR,
|
||||
GUI_COLOR_BAR_CHAR,
|
||||
|
||||
@@ -437,7 +437,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
|
||||
enum t_gui_bar_filling filling;
|
||||
char *ptr_content, *content, reinit_color[32], reinit_color_space[32];
|
||||
char *item_value, *item_value2, ****split_items, **linear_items;
|
||||
int index_content, content_length, i, sub, j, k, index;
|
||||
int index_content, content_length, i, first_sub_item, sub, j, k, index;
|
||||
int length_reinit_color, length_reinit_color_space;
|
||||
int length, max_length, max_length_screen, total_items, columns, lines;
|
||||
|
||||
@@ -470,6 +470,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
|
||||
case GUI_BAR_FILLING_VERTICAL: /* items separated by \n */
|
||||
for (i = 0; i < bar_window->items_count; i++)
|
||||
{
|
||||
first_sub_item = 1;
|
||||
for (sub = 0; sub < bar_window->items_subcount[i]; sub++)
|
||||
{
|
||||
ptr_content = gui_bar_window_content_get (bar_window, window,
|
||||
@@ -504,7 +505,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
|
||||
content_length += length_reinit_color_space +
|
||||
strlen ((item_value) ? item_value : ptr_content);
|
||||
content = realloc (content, content_length);
|
||||
if (sub == 0)
|
||||
if (first_sub_item)
|
||||
{
|
||||
/* first sub item: insert space after last item */
|
||||
if (gui_bar_get_filling (bar_window->bar) == GUI_BAR_FILLING_HORIZONTAL)
|
||||
@@ -518,6 +519,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
|
||||
}
|
||||
strcat (content,
|
||||
(item_value) ? item_value : ptr_content);
|
||||
first_sub_item = 0;
|
||||
}
|
||||
if (item_value)
|
||||
free (item_value);
|
||||
|
||||
Reference in New Issue
Block a user