[hackers] [st] Reverse the cursor on selection. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Mon, 5 Oct 2015 21:07:21 +0200 (CEST)

commit 2677296147fe658376be67821449b8f232c65064
Author: Christoph Lohmann <20h_AT_r-36.net>
AuthorDate: Mon Oct 5 21:06:42 2015 +0200
Commit: Christoph Lohmann <20h_AT_r-36.net>
CommitDate: Mon Oct 5 21:06:42 2015 +0200

    Reverse the cursor on selection.

diff --git a/st.c b/st.c
index 144954b..e0417e5 100644
--- a/st.c
+++ b/st.c
_AT_@ -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);
_AT_@ -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);
Received on Mon Oct 05 2015 - 21:07:21 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 05 2015 - 21:12:10 CEST