We need to draw the final character of a selection with inversed
background, too. This is a bit tricky as the selection may be inversed
itself. Therefore, we just keep a flag that tells us whether the previous
character was selected and just draw the new character also selected.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
size_t len;
struct cell empty;
bool in_sel = false, sel_start = false, sel_end = false;
+ bool was_sel = false;
if (!con || !draw_cb)
return;
sel_end = true;
else
sel_end = false;
+
+ was_sel = false;
}
for (j = 0; j < con->size_x; ++j) {
if (con->sel_active) {
if (sel_start &&
- j == con->sel_start.x)
+ j == con->sel_start.x) {
+ was_sel = in_sel;
in_sel = !in_sel;
+ }
if (sel_end &&
- j == con->sel_end.x)
+ j == con->sel_end.x) {
+ was_sel = in_sel;
in_sel = !in_sel;
+ }
}
if (k == cur_y + 1 &&
if (con->flags & TSM_SCREEN_INVERSE)
attr.inverse = !attr.inverse;
- if (in_sel)
+ if (in_sel || was_sel) {
+ was_sel = false;
attr.inverse = !attr.inverse;
+ }
ch = tsm_symbol_get(NULL, &cell->ch, &len);
if (cell->ch == ' ' || cell->ch == 0)