Created
February 14, 2019 21:39
-
-
Save lpatalas/7e6c7cf4b3f880cce5bcda6e14861eaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config.h b/config.h | |
index 53ab366..6102012 100644 | |
--- a/config.h | |
+++ b/config.h | |
@@ -54,7 +54,7 @@ static unsigned int blinktimeout = 800; | |
/* | |
* thickness of underline and bar cursors | |
*/ | |
-static unsigned int cursorthickness = 2; | |
+static unsigned int cursorthickness = 1; | |
/* | |
* bell volume. It must be a value between -100 and 100. Use 0 for disabling | |
@@ -123,12 +123,15 @@ static unsigned int defaultrcs = 257; | |
/* | |
* Default shape of cursor | |
+ * 1: Blinking Block | |
* 2: Block ("█") | |
+ * 3: Blinking Underline | |
* 4: Underline ("_") | |
+ * 5: Blinking Bar | |
* 6: Bar ("|") | |
* 7: Snowman ("☃") | |
*/ | |
-static unsigned int cursorshape = 2; | |
+static unsigned int cursorshape = 1; | |
/* | |
* Default columns and rows numbers | |
diff --git a/x.c b/x.c | |
index 30ddeca..d744fcc 100644 | |
--- a/x.c | |
+++ b/x.c | |
@@ -1487,10 +1487,14 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) | |
g.u = 0x2603; | |
case 0: /* Blinking Block */ | |
case 1: /* Blinking Block (Default) */ | |
+ if (IS_SET(MODE_BLINK)) | |
+ break; | |
case 2: /* Steady Block */ | |
xdrawglyph(g, cx, cy); | |
break; | |
case 3: /* Blinking Underline */ | |
+ if (IS_SET(MODE_BLINK)) | |
+ break; | |
case 4: /* Steady Underline */ | |
XftDrawRect(xw.draw, &drawcol, | |
borderpx + cx * win.cw, | |
@@ -1499,6 +1503,8 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) | |
win.cw, cursorthickness); | |
break; | |
case 5: /* Blinking bar */ | |
+ if (IS_SET(MODE_BLINK)) | |
+ break; | |
case 6: /* Steady bar */ | |
XftDrawRect(xw.draw, &drawcol, | |
borderpx + cx * win.cw, | |
@@ -1822,6 +1828,10 @@ run(void) | |
int ttyfd; | |
struct timespec drawtimeout, *tv = NULL, now, last, lastblink; | |
long deltatime; | |
+ int blink_cursor = win.cursor == 0 | |
+ || win.cursor == 1 | |
+ || win.cursor == 3 | |
+ || win.cursor == 5; | |
/* Waiting for window mapping */ | |
do { | |
@@ -1858,7 +1868,7 @@ run(void) | |
if (FD_ISSET(ttyfd, &rfd)) { | |
ttyread(); | |
if (blinktimeout) { | |
- blinkset = tattrset(ATTR_BLINK); | |
+ blinkset = blink_cursor || tattrset(ATTR_BLINK); | |
if (!blinkset) | |
MODBIT(win.mode, 0, MODE_BLINK); | |
} | |
-- | |
2.20.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment