1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

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
This commit is contained in:
Michael Vetter 2019-12-13 12:19:07 +01:00
parent 14f25992c3
commit a1ed37953c

View File

@ -1650,6 +1650,18 @@ _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pa
free(word); free(word);
} }
void
win_print_separator(ProfWin *window)
{
int cols = getmaxx(window->layout->win);
int i;
for (i=1; i<cols; i++) {
wprintw(window->layout->win, "-");
}
wprintw(window->layout->win, "\n");
}
void void
win_redraw(ProfWin *window) win_redraw(ProfWin *window)
{ {
@ -1659,9 +1671,14 @@ win_redraw(ProfWin *window)
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i); ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i);
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); _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt);
} }
} }
}
gboolean gboolean
win_has_active_subwin(ProfWin *window) win_has_active_subwin(ProfWin *window)
@ -1817,23 +1834,12 @@ win_handle_command_exec_result_note(ProfWin *window, const char *const type, con
win_println(window, THEME_DEFAULT, '!', value); win_println(window, THEME_DEFAULT, '!', value);
} }
void
win_print_separator(ProfWin *window)
{
int cols = getmaxx(window->layout->win);
int i;
for (i=1; i<cols; i++) {
wprintw(window->layout->win, "-");
}
}
void void
win_insert_last_read_position_marker(ProfWin *window, char* id) win_insert_last_read_position_marker(ProfWin *window, char* id)
{ {
GDateTime *time = g_date_time_new_now_local(); 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 // can we leave this? TODO
// win_print_separator(window); // win_print_separator(window);
//_win_print(window, '-', 0, time, 0, THEME_TEXT, NULL, "---", NULL); //_win_print(window, '-', 0, time, 0, THEME_TEXT, NULL, "---", NULL);