aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st.c62
1 files changed, 49 insertions, 13 deletions
diff --git a/st.c b/st.c
index 836ae21..68dc2be 100644
--- a/st.c
+++ b/st.c
@@ -197,14 +197,14 @@ typedef struct {
197} TCursor; 197} TCursor;
198 198
199/* CSI Escape sequence structs */ 199/* CSI Escape sequence structs */
200/* ESC '[' [[ [<priv>] <arg> [;]] <mode>] */ 200/* ESC '[' [[ [<priv>] <arg> [;]] <mode> [<mode>]] */
201typedef struct { 201typedef struct {
202 char buf[ESC_BUF_SIZ]; /* raw string */ 202 char buf[ESC_BUF_SIZ]; /* raw string */
203 int len; /* raw string length */ 203 int len; /* raw string length */
204 char priv; 204 char priv;
205 int arg[ESC_ARG_SIZ]; 205 int arg[ESC_ARG_SIZ];
206 int narg; /* nb of args */ 206 int narg; /* nb of args */
207 char mode; 207 char mode[2];
208} CSIEscape; 208} CSIEscape;
209 209
210/* STR Escape sequence structs */ 210/* STR Escape sequence structs */
@@ -257,6 +257,7 @@ typedef struct {
257 int ch; /* char height */ 257 int ch; /* char height */
258 int cw; /* char width */ 258 int cw; /* char width */
259 char state; /* focus, redraw, visible */ 259 char state; /* focus, redraw, visible */
260 int cursor; /* cursor style */
260} XWindow; 261} XWindow;
261 262
262typedef struct { 263typedef struct {
@@ -1547,7 +1548,8 @@ csiparse(void) {
1547 break; 1548 break;
1548 p++; 1549 p++;
1549 } 1550 }
1550 csiescseq.mode = *p; 1551 csiescseq.mode[0] = *p++;
1552 csiescseq.mode[1] = (p < csiescseq.buf+csiescseq.len) ? *p : '\0';
1551} 1553}
1552 1554
1553/* for absolute user moves, when decom is set */ 1555/* for absolute user moves, when decom is set */
@@ -1985,7 +1987,7 @@ csihandle(void) {
1985 char buf[40]; 1987 char buf[40];
1986 int len; 1988 int len;
1987 1989
1988 switch(csiescseq.mode) { 1990 switch(csiescseq.mode[0]) {
1989 default: 1991 default:
1990 unknown: 1992 unknown:
1991 fprintf(stderr, "erresc: unknown csi "); 1993 fprintf(stderr, "erresc: unknown csi ");
@@ -2173,6 +2175,19 @@ csihandle(void) {
2173 case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ 2175 case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */
2174 tcursor(CURSOR_LOAD); 2176 tcursor(CURSOR_LOAD);
2175 break; 2177 break;
2178 case ' ':
2179 switch (csiescseq.mode[1]) {
2180 case 'q': /* DECSCUSR -- Set Cursor Style */
2181 DEFAULT(csiescseq.arg[0], 1);
2182 if (!BETWEEN(csiescseq.arg[0], 0, 6)) {
2183 goto unknown;
2184 }
2185 xw.cursor = csiescseq.arg[0];
2186 break;
2187 default:
2188 goto unknown;
2189 }
2190 break;
2176 } 2191 }
2177} 2192}
2178 2193
@@ -3553,16 +3568,36 @@ xdrawcursor(void) {
3553 3568
3554 /* draw the new one */ 3569 /* draw the new one */
3555 if(xw.state & WIN_FOCUSED) { 3570 if(xw.state & WIN_FOCUSED) {
3556 if(IS_SET(MODE_REVERSE)) { 3571 switch (xw.cursor) {
3557 g.mode |= ATTR_REVERSE; 3572 case 0: /* Blinking Block */
3558 g.fg = defaultcs; 3573 case 1: /* Blinking Block (Default) */
3559 g.bg = defaultfg; 3574 case 2: /* Steady Block */
3560 } 3575 if(IS_SET(MODE_REVERSE)) {
3576 g.mode |= ATTR_REVERSE;
3577 g.fg = defaultcs;
3578 g.bg = defaultfg;
3579 }
3561 3580
3562 sl = utf8len(g.c); 3581 sl = utf8len(g.c);
3563 width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ 3582 width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\
3564 ? 2 : 1; 3583 ? 2 : 1;
3565 xdraws(g.c, g, term.c.x, term.c.y, width, sl); 3584 xdraws(g.c, g, term.c.x, term.c.y, width, sl);
3585 break;
3586 case 3: /* Blinking Underline */
3587 case 4: /* Steady Underline */
3588 XftDrawRect(xw.draw, &dc.col[defaultcs],
3589 borderpx + curx * xw.cw,
3590 borderpx + (term.c.y + 1) * xw.ch - 1,
3591 xw.cw, 1);
3592 break;
3593 case 5: /* Blinking bar */
3594 case 6: /* Steady bar */
3595 XftDrawRect(xw.draw, &dc.col[defaultcs],
3596 borderpx + curx * xw.cw,
3597 borderpx + term.c.y * xw.ch,
3598 1, xw.ch);
3599 break;
3600 }
3566 } else { 3601 } else {
3567 XftDrawRect(xw.draw, &dc.col[defaultcs], 3602 XftDrawRect(xw.draw, &dc.col[defaultcs],
3568 borderpx + curx * xw.cw, 3603 borderpx + curx * xw.cw,
@@ -3987,6 +4022,7 @@ main(int argc, char *argv[]) {
3987 4022
3988 xw.l = xw.t = 0; 4023 xw.l = xw.t = 0;
3989 xw.isfixed = False; 4024 xw.isfixed = False;
4025 xw.cursor = 0;
3990 4026
3991 ARGBEGIN { 4027 ARGBEGIN {
3992 case 'a': 4028 case 'a':