From a1ed37953cfcfb81533f90e68e0c388ff2def788 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Fri, 13 Dec 2019 12:19:07 +0100 Subject: [PATCH] separator: print trackbar across the whole line Use the whole line. We do this in win_redraw() so upon terminal size change it still matches. Regards https://github.com/profanity-im/profanity/issues/1238 --- src/ui/window.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/ui/window.c b/src/ui/window.c index e592aa2e..28c76348 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1650,6 +1650,18 @@ _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pa free(word); } +void +win_print_separator(ProfWin *window) +{ + int cols = getmaxx(window->layout->win); + + int i; + for (i=1; ilayout->win, "-"); + } + wprintw(window->layout->win, "\n"); +} + void win_redraw(ProfWin *window) { @@ -1659,7 +1671,12 @@ win_redraw(ProfWin *window) for (i = 0; i < size; i++) { ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i); - _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt); + + if (e->from == NULL && e->message && e->message[0] == '-') { + win_print_separator(window); + } else { + _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt); + } } } @@ -1817,23 +1834,12 @@ win_handle_command_exec_result_note(ProfWin *window, const char *const type, con win_println(window, THEME_DEFAULT, '!', value); } -void -win_print_separator(ProfWin *window) -{ - int cols = getmaxx(window->layout->win); - - int i; - for (i=1; ilayout->win, "-"); - } -} - void win_insert_last_read_position_marker(ProfWin *window, char* id) { GDateTime *time = g_date_time_new_now_local(); - buffer_append(window->layout->buffer, ' ', 0, time, 0, THEME_TEXT, NULL, "-----", NULL, id); + buffer_append(window->layout->buffer, ' ', 0, time, 0, THEME_TEXT, NULL, "-", NULL, id); // can we leave this? TODO // win_print_separator(window); //_win_print(window, '-', 0, time, 0, THEME_TEXT, NULL, "---", NULL);