vis

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

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

commit 070299e2da1ee0ff09bf0624ae982d802ab696a8
parent 5756da54ad6550b08e176d0b25c36710c6ab051b
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  9 Dec 2017 12:01:03 +0100

vis: make selections visible when lua support has been disabled

When the fore and background colors are the same, swapping them has
no effect. Instead use the specified cell attributes.  Previously the
CELL_ATTR_REVERSE used in the default selection style was ignored.

In general the default style definitions for non-Lua builds could
probably be improved further.

Fix #635

Diffstat:
Mvis.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vis.c b/vis.c @@ -352,8 +352,12 @@ static void window_draw_selection(View *view, Selection *cur, CellStyle *style) while (col < end) { if (cell_color_equal(l->cells[col].style.fg, style->bg)) { CellStyle old = l->cells[col].style; - l->cells[col].style.fg = old.bg; - l->cells[col].style.bg = old.fg; + if (!cell_color_equal(old.fg, old.bg)) { + l->cells[col].style.fg = old.bg; + l->cells[col].style.bg = old.fg; + } else { + l->cells[col].style.attr = style->attr; + } } else { l->cells[col].style.bg = style->bg; }