aboutsummaryrefslogtreecommitdiff
path: root/ui-curses.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-04-04 15:09:04 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-04-04 15:09:04 +0200
commit1304c0680b8db9d8526eb36f0b563d534703338b (patch)
treef2ed8f4d8f277e81a446af169a50aa053e69c655 /ui-curses.c
parent9d001dabd161c6db3c631bd34712111fbf7ea942 (diff)
downloadvis-1304c0680b8db9d8526eb36f0b563d534703338b.tar.gz
vis-1304c0680b8db9d8526eb36f0b563d534703338b.tar.xz
Fix drawing of selection
Diffstat (limited to 'ui-curses.c')
-rw-r--r--ui-curses.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui-curses.c b/ui-curses.c
index 3d144c0..e7986eb 100644
--- a/ui-curses.c
+++ b/ui-curses.c
@@ -361,20 +361,17 @@ static void ui_window_cursor_to(UiWin *w, int x, int y) {
static void ui_window_draw_text(UiWin *w, const Line *line) {
UiCursesWin *win = (UiCursesWin*)w;
wmove(win->win, 0, 0);
- attr_t attr = 0;
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 == 0)
- waddch(win->win, ' ');
-
- for (int x = 0; x < l->width; x++) {
- attr_t newattr = l->cells[x].attr;
- if (newattr != attr) {
- wattrset(win->win, newattr);
- attr = newattr;
+ if (l->width == 1 && l->cells[0].data[0] == '\n') {
+ wattrset(win->win, l->cells[0].attr);
+ waddstr(win->win, " \n");
+ } else {
+ for (int x = 0; x < l->width; x++) {
+ wattrset(win->win, l->cells[x].attr);
+ waddstr(win->win, l->cells[x].data);
}
- waddstr(win->win, l->cells[x].data);
}
wclrtoeol(win->win);
}