diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-07-25 12:38:13 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-07-26 12:20:55 +0200 |
| commit | d58a37a179474d42bae6ec718ea0cf4578eb9f2a (patch) | |
| tree | 1d6d6b5a13a5e4c63f2470fbc652b0c5e96572b2 /ui-curses.c | |
| parent | d7a7a3efde175e944cc6943170c9f60467850060 (diff) | |
| download | vis-d58a37a179474d42bae6ec718ea0cf4578eb9f2a.tar.gz vis-d58a37a179474d42bae6ec718ea0cf4578eb9f2a.tar.xz | |
view: always fill out complete cell matrix
Diffstat (limited to 'ui-curses.c')
| -rw-r--r-- | ui-curses.c | 30 |
1 files changed, 8 insertions, 22 deletions
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) { |
