aboutsummaryrefslogtreecommitdiff
path: root/terminal.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-15 14:07:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-15 14:07:56 +0000
commit7d29435d8648f076639a82a01330bcebf2bab81d (patch)
tree1a9a2b2d16be18dded031b7b66b6fc996a8c8a71 /terminal.h
parentfdm: close fd even if we didn't find it in our list (diff)
term: implement cursor blinking
Blinking can be enabled either by setting the cursor style with CSI Ps SP q and selecting a blinking style. Or, with 'CSI ? 12 h' Note that both affect the same internal state. I.e. you can disable blinking with CSI ? 12l after having selected a blinking cursor style. This is consistent with XTerm behavior.
Diffstat (limited to 'terminal.h')
-rw-r--r--terminal.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/terminal.h b/terminal.h
index b73f1c21..e29f5269 100644
--- a/terminal.h
+++ b/terminal.h
@@ -232,7 +232,10 @@ struct terminal {
struct cursor alt_saved_cursor;
enum cursor_style default_cursor_style;
enum cursor_style cursor_style;
- bool cursor_blinking;
+ struct {
+ enum { CURSOR_BLINK_ON, CURSOR_BLINK_OFF } state;
+ int fd;
+ } cursor_blink;
struct {
uint32_t text;
uint32_t cursor;
@@ -292,6 +295,7 @@ struct terminal {
struct coord actual; /* Absolute */
struct coord in_view; /* Offset by view */
struct cell *cell; /* For easy access to content */
+ int blink_state;
} last_cursor;
struct buffer *last_buf; /* Buffer we rendered to last time */
@@ -345,6 +349,8 @@ void term_cursor_left(struct terminal *term, int count);
void term_cursor_right(struct terminal *term, int count);
void term_cursor_up(struct terminal *term, int count);
void term_cursor_down(struct terminal *term, int count);
+void term_cursor_blink_enable(struct terminal *term);
+void term_cursor_blink_disable(struct terminal *term);
void term_scroll(struct terminal *term, int rows);
void term_scroll_reverse(struct terminal *term, int rows);