From d58a37a179474d42bae6ec718ea0cf4578eb9f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 25 Jul 2015 12:38:13 +0200 Subject: view: always fill out complete cell matrix --- ui-curses.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'ui-curses.c') diff --git a/ui-curses.c b/ui-curses.c index 5f72a2e..9ab394b 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -358,31 +358,17 @@ static void ui_window_free(UiWin *w) { static void ui_window_draw_text(UiWin *w, const Line *line) { UiCursesWin *win = (UiCursesWin*)w; wmove(win->win, 0, 0); + int width = view_width_get(win->view); for (const Line *l = line; l; l = l->next) { - /* add a single space in an otherwise empty line to make - * the selection cohorent */ - if (l->width == 1 && l->cells[0].data[0] == '\n') { - int attr = l->cells[0].attr; - if (l->cells[0].cursor) + for (int x = 0; x < width; x++) { + int attr = l->cells[x].attr; + if (l->cells[x].cursor && (win->ui->selwin == win || win->ui->prompt_win == win)) attr = A_NORMAL | A_REVERSE; - if (l->cells[0].selected) + if (l->cells[x].selected) attr |= A_REVERSE; wattrset(win->win, attr); - waddstr(win->win, " \n"); - } else { - for (int x = 0; x < l->width; x++) { - int attr = l->cells[x].attr; - if (l->cells[x].cursor) - attr = A_NORMAL | A_REVERSE; - if (l->cells[x].selected) - attr |= A_REVERSE; - wattrset(win->win, attr); - waddstr(win->win, l->cells[x].data); - } - if (l->width != win->width - win->sidebar_width) - waddstr(win->win, "\n"); + waddstr(win->win, l->cells[x].data); } - wclrtoeol(win->win); } wclrtobot(win->win); @@ -394,8 +380,8 @@ static void ui_window_focus(UiWin *w) { UiCursesWin *oldsel = win->ui->selwin; win->ui->selwin = win; if (oldsel) - ui_window_draw_status((UiWin*)oldsel); - ui_window_draw_status(w); + ui_window_draw((UiWin*)oldsel); + ui_window_draw(w); } static void ui_window_options(UiWin *w, enum UiOption options) { -- cgit v1.2.3