aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-22 17:44:21 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-22 17:44:21 +0000
commit10be7c37ba6ca2dc83ab34cc296bf2618873014e (patch)
tree80b7be918bd5f2e64028ade031e077f3da721386
parentterm: group 'blink' state together in a struct (diff)
csi: prepare for alternative cursor styles
-rw-r--r--csi.c29
-rw-r--r--terminal.h2
2 files changed, 19 insertions, 12 deletions
diff --git a/csi.c b/csi.c
index cc23617a..2028df8d 100644
--- a/csi.c
+++ b/csi.c
@@ -929,22 +929,27 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 'q': {
int param = vt_param_get(term, 0, 0);
switch (param) {
- case 2: /* steady block */
+ case 0: case 1: /* blinking block */
+ case 2: /* steady block */
+ term->cursor_style = CURSOR_BLOCK;
break;
- case 0:
- case 1: /* blinking block */
- case 3: /* blinking underline */
- case 4: /* steady underline */
- case 5: /* blinking bar */
- case 6: /* steady bar */
- LOG_WARN("unimplemented: cursor style: %s",
- param == 0 || param == 1 ? "blinking block" :
- param == 3 ? "blinking underline" :
- param == 4 ? "steady underline" :
- param == 5 ? "blinking bar" : "steady bar");
+ case 3: /* blinking underline */
+ case 4: /* steady underline */
+ term->cursor_style = CURSOR_UNDERLINE;
+ LOG_WARN("unimplemented: cursor style: underline");
+ break;
+
+ case 5: /* blinking bar */
+ case 6: /* steady bar */
+ term->cursor_style = CURSOR_BAR;
+ LOG_WARN("unimplemented: cursor style: bar");
break;
}
+
+ term->cursor_blinking = param == 0 || param & 1;
+ if (term->cursor_blinking)
+ LOG_WARN("unimplemented: blinking cursor");
break;
}
diff --git a/terminal.h b/terminal.h
index 451d7ac9..0232388c 100644
--- a/terminal.h
+++ b/terminal.h
@@ -291,6 +291,8 @@ struct terminal {
struct coord cursor;
struct coord saved_cursor;
struct coord alt_saved_cursor;
+ enum { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BAR } cursor_style;
+ bool cursor_blinking;
uint32_t input_serial;
struct {