From 7d29435d8648f076639a82a01330bcebf2bab81d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 15 Dec 2019 15:07:56 +0100 Subject: 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. --- terminal.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'terminal.h') 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); -- cgit v1.3