aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2015-10-05 21:06:42 +0200
committerChristoph Lohmann <20h@r-36.net>2015-10-05 21:06:42 +0200
commit2677296147fe658376be67821449b8f232c65064 (patch)
treee67afaa4ba59a907285434c24b4fbd89b300e973
parent5ece2b5f4a2e56ddfb82e797dc973fca38c5273d (diff)
downloadst-2677296147fe658376be67821449b8f232c65064.tar.gz
Reverse the cursor on selection.
-rw-r--r--st.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/st.c b/st.c
index 144954b..e0417e5 100644
--- a/st.c
+++ b/st.c
@@ -3828,6 +3828,7 @@ xdrawcursor(void)
static int oldx = 0, oldy = 0;
int curx;
Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs};
+ int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN);
LIMIT(oldx, 0, term.col-1);
LIMIT(oldy, 0, term.row-1);
@@ -3841,6 +3842,8 @@ xdrawcursor(void)
curx--;
g.u = term.line[term.c.y][term.c.x].u;
+ if (ena_sel && selected(term.c.x, term.c.y))
+ g.mode ^= ATTR_REVERSE;
/* remove the old cursor */
xdrawglyph(term.line[oldy][oldx], oldx, oldy);
remember that computers suck.