aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-12-09 12:01:03 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-12-09 12:23:07 +0100
commit69453a73fce015b9dd9deb6a9f6ab9aad104619b (patch)
tree7a6e6cc2ab130c0a5b5ac4a3486de7a5e59ffabb
parent8e27737bd4e9ff1c275a0cb439bfe2280ffa3f62 (diff)
downloadvis-69453a73fce015b9dd9deb6a9f6ab9aad104619b.tar.gz
vis-69453a73fce015b9dd9deb6a9f6ab9aad104619b.tar.xz
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
-rw-r--r--vis.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index edf3f0c..4990aed 100644
--- 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;
}