From 8d69edfa313722da5d340b668f610606959ba4d4 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 4 May 2009 19:17:42 +0200 Subject: [PATCH] Use or '\r' in bar items to force new line with horizontal filling --- src/gui/curses/gui-curses-bar-window.c | 20 ++++++-------------- src/gui/gui-bar-window.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 2388ea36a..bcae4f565 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -513,22 +513,14 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, { some_data_not_displayed = 1; } - if (filling != GUI_BAR_FILLING_HORIZONTAL) + while (x < bar_window->width) { - while (x < bar_window->width) - { - gui_bar_window_print_string (bar_window, - &x, &y, - " ", 0); - } - x = 0; - y++; - } - else - { - gui_bar_window_print_string (bar_window, &x, &y, - space_with_reinit_color, 0); + gui_bar_window_print_string (bar_window, + &x, &y, + " ", 0); } + x = 0; + y++; } } if ((bar_window->cursor_x < 0) && (bar_window->cursor_y < 0) diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 978fb3511..ce34c726d 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -436,7 +436,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, ****split_items, **linear_items; + char *item_value, *item_value2, ****split_items, **linear_items; int index_content, content_length, i, sub, j, k, index; int length_reinit_color, length_reinit_color_space; int length, max_length, max_length_screen, total_items, columns, lines; @@ -480,6 +480,16 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window, { item_value = string_replace (ptr_content, "\n", reinit_color_space); + if (item_value) + { + item_value2 = string_replace (item_value, + "\r", "\n"); + if (item_value2) + { + free (item_value); + item_value = item_value2; + } + } } else item_value = NULL;