mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tui: always hide cursor when flushing
The previous commit ensures that we can never flush the buffer in a
state where toggling cursor visibility can corrupt other escape codes.
Thus, we can remove the workaround added as part of e838452
, simplyfing
the code and hiding the cursor on more occasions.
This commit is contained in:
parent
90dd2b1473
commit
54087d80f3
@ -297,7 +297,7 @@ static void terminfo_stop(UI *ui)
|
|||||||
unibi_out_ext(ui, data->unibi_ext.disable_bracketed_paste);
|
unibi_out_ext(ui, data->unibi_ext.disable_bracketed_paste);
|
||||||
// Disable focus reporting
|
// Disable focus reporting
|
||||||
unibi_out_ext(ui, data->unibi_ext.disable_focus_reporting);
|
unibi_out_ext(ui, data->unibi_ext.disable_focus_reporting);
|
||||||
flush_buf(ui, true);
|
flush_buf(ui);
|
||||||
uv_tty_reset_mode();
|
uv_tty_reset_mode();
|
||||||
uv_close((uv_handle_t *)&data->output_handle, NULL);
|
uv_close((uv_handle_t *)&data->output_handle, NULL);
|
||||||
uv_run(&data->write_loop, UV_RUN_DEFAULT);
|
uv_run(&data->write_loop, UV_RUN_DEFAULT);
|
||||||
@ -1061,7 +1061,7 @@ static void tui_flush(UI *ui)
|
|||||||
|
|
||||||
cursor_goto(ui, saved_row, saved_col);
|
cursor_goto(ui, saved_row, saved_col);
|
||||||
|
|
||||||
flush_buf(ui, true);
|
flush_buf(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
@ -1230,7 +1230,7 @@ retry: \
|
|||||||
unibi_format(vars, vars + 26, str, data->params, out, ui, NULL, NULL); \
|
unibi_format(vars, vars + 26, str, data->params, out, ui, NULL, NULL); \
|
||||||
if (data->overflow) { \
|
if (data->overflow) { \
|
||||||
data->bufpos = orig_pos; \
|
data->bufpos = orig_pos; \
|
||||||
flush_buf(ui, true); \
|
flush_buf(ui); \
|
||||||
goto retry; \
|
goto retry; \
|
||||||
} \
|
} \
|
||||||
data->cork = false; \
|
data->cork = false; \
|
||||||
@ -1261,7 +1261,7 @@ static void out(void *ctx, const char *str, size_t len)
|
|||||||
data->overflow = true;
|
data->overflow = true;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
flush_buf(ui, true);
|
flush_buf(ui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1679,7 +1679,7 @@ static void augment_terminfo(TUIData *data, const char *term,
|
|||||||
"\x1b[?1002l\x1b[?1006l");
|
"\x1b[?1002l\x1b[?1006l");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flush_buf(UI *ui, bool toggle_cursor)
|
static void flush_buf(UI *ui)
|
||||||
{
|
{
|
||||||
uv_write_t req;
|
uv_write_t req;
|
||||||
uv_buf_t bufs[3];
|
uv_buf_t bufs[3];
|
||||||
@ -1690,7 +1690,7 @@ static void flush_buf(UI *ui, bool toggle_cursor)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toggle_cursor && !data->is_invisible) {
|
if (!data->is_invisible) {
|
||||||
// cursor is visible. Write a "cursor invisible" command before writing the
|
// cursor is visible. Write a "cursor invisible" command before writing the
|
||||||
// buffer.
|
// buffer.
|
||||||
bufp->base = data->invis;
|
bufp->base = data->invis;
|
||||||
@ -1705,7 +1705,7 @@ static void flush_buf(UI *ui, bool toggle_cursor)
|
|||||||
bufp++;
|
bufp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toggle_cursor && !data->busy && data->is_invisible) {
|
if (!data->busy && data->is_invisible) {
|
||||||
// not busy and the cursor is invisible. Write a "cursor normal" command
|
// not busy and the cursor is invisible. Write a "cursor normal" command
|
||||||
// after writing the buffer.
|
// after writing the buffer.
|
||||||
bufp->base = data->norm;
|
bufp->base = data->norm;
|
||||||
|
Loading…
Reference in New Issue
Block a user