[dev] [st] keep some glyph modes for the cursor

From: Nils Reuße <n.reusse_AT_hxgn.net>
Date: Mon, 6 Feb 2017 14:09:15 +0100 (CET)

st currently does not keep any mode for the cursor that was active in the underlying glyph (e.g. italic text), the mode is always ATTR_NULL [1]. At [2] you can find a screenshot that shows the implications. Other terminals (at least vte-based, such as XFCE-terminal) keep some modes for the cursor. I find the current behaviour very disruptive, so here is a patch that keeps a few (arbitrarily chosen) modes for the cursor.

Any comments?

Thanks and king regards
Nils

[1] http://git.suckless.org/st/tree/st.c#n3963
[2] http://i.imgur.com/R2yCEaC.png


diff --git a/st.c b/st.c
index 708e7ae..f91545b 100644
--- a/st.c
+++ b/st.c
_AT_@ -3998,6 +3998,8 @@ xdrawcursor(void)
         xdrawglyph(og, oldx, oldy);
 
         g.u = term.line[term.c.y][term.c.x].u;
+ ushort keep_mode = (ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK);
+ g.mode |= (term.line[term.c.y][term.c.x].mode & keep_mode);
 
         /*
          * Select the right color for the right mode.
Received on Mon Feb 06 2017 - 14:09:15 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 06 2017 - 14:12:13 CET