vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit a5698a5a86121a7aecb6be3256a6a6b835a64ca5
parent 309ea0813eedd1984871c5bc60087a3eeab49c64
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 12 Mar 2016 16:40:09 +0100

ui: use correct default cell style

This is important for files without associated syntax highlighting.

The selections should now again be visible.

Diffstat:
Mui-curses.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ui-curses.c b/ui-curses.c @@ -688,7 +688,10 @@ static void ui_window_draw(UiWin *w) { for (const Line *l = view_lines_get(win->view); l; l = l->next) { bool cursor_line = l->lineno == cursor_lineno; for (int x = 0; x < width; x++) { - CellStyle *style = &win->styles[l->cells[x].attr]; + unsigned int style_id = l->cells[x].attr; + if (style_id == 0) + style_id = UI_STYLE_DEFAULT; + CellStyle *style = &win->styles[style_id]; if (l->cells[x].cursor && win->ui->selwin == win) { if (multiple_cursors && l->cells[x].cursor_primary) attr = style_to_attr(&win->styles[UI_STYLE_CURSOR_PRIMARY]);