Fix cursor redraw in terminals
This commit is contained in:
parent
132b77ba53
commit
bc1cce36e2
@ -553,9 +553,11 @@ void render_cursor() {
|
||||
cell_redraw_inverted(csr_x, csr_y);
|
||||
}
|
||||
|
||||
static uint8_t cursor_flipped = 0;
|
||||
void draw_cursor() {
|
||||
if (!cursor_on) return;
|
||||
mouse_ticks = get_ticks();
|
||||
cursor_flipped = 0;
|
||||
render_cursor();
|
||||
}
|
||||
|
||||
@ -684,6 +686,9 @@ int term_get_csr_y() {
|
||||
|
||||
void term_set_csr_show(int on) {
|
||||
cursor_on = on;
|
||||
if (on) {
|
||||
draw_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
void term_set_colors(uint32_t fg, uint32_t bg) {
|
||||
@ -698,7 +703,6 @@ void term_redraw_cursor() {
|
||||
}
|
||||
|
||||
void flip_cursor() {
|
||||
static uint8_t cursor_flipped = 0;
|
||||
if (cursor_flipped) {
|
||||
cell_redraw(csr_x, csr_y);
|
||||
} else {
|
||||
|
@ -854,16 +854,17 @@ static void render_cursor() {
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t cursor_flipped = 0;
|
||||
/* A soft request to draw the cursor. */
|
||||
static void draw_cursor() {
|
||||
if (!cursor_on) return;
|
||||
mouse_ticks = get_ticks();
|
||||
cursor_flipped = 0;
|
||||
render_cursor();
|
||||
}
|
||||
|
||||
/* Timer callback to flip (flash) the cursor */
|
||||
static void maybe_flip_cursor(void) {
|
||||
static uint8_t cursor_flipped = 0;
|
||||
uint64_t ticks = get_ticks();
|
||||
if (ticks > mouse_ticks + 600000LL) {
|
||||
mouse_ticks = ticks;
|
||||
@ -1218,6 +1219,9 @@ static int term_get_cell_height(void) {
|
||||
/* ANSI callback to set cursor visibility */
|
||||
static void term_set_csr_show(int on) {
|
||||
cursor_on = on;
|
||||
if (on) {
|
||||
draw_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
/* ANSI callback to set the foreground/background colors. */
|
||||
|
Loading…
Reference in New Issue
Block a user