mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 21:38:19 +00:00
tui: Track cursor visibility.
This fixes a test failure caused by dfaecb25f6a9a94f29a38d9f2d24a579b3dff5f not tracking what the current visibility is and whether it matches the current business state.
This commit is contained in:
@@ -96,7 +96,7 @@ typedef struct {
|
|||||||
bool can_set_left_right_margin;
|
bool can_set_left_right_margin;
|
||||||
bool immediate_wrap_after_last_column;
|
bool immediate_wrap_after_last_column;
|
||||||
bool mouse_enabled;
|
bool mouse_enabled;
|
||||||
bool busy;
|
bool busy, is_invisible;
|
||||||
cursorentry_T cursor_shapes[SHAPE_IDX_COUNT];
|
cursorentry_T cursor_shapes[SHAPE_IDX_COUNT];
|
||||||
HlAttrs print_attrs;
|
HlAttrs print_attrs;
|
||||||
bool default_attr;
|
bool default_attr;
|
||||||
@@ -173,6 +173,8 @@ static void terminfo_start(UI *ui)
|
|||||||
data->scroll_region_is_full_screen = true;
|
data->scroll_region_is_full_screen = true;
|
||||||
data->bufpos = 0;
|
data->bufpos = 0;
|
||||||
data->default_attr = false;
|
data->default_attr = false;
|
||||||
|
data->is_invisible = true;
|
||||||
|
data->busy = false;
|
||||||
data->showing_mode = SHAPE_IDX_N;
|
data->showing_mode = SHAPE_IDX_N;
|
||||||
data->unibi_ext.enable_mouse = -1;
|
data->unibi_ext.enable_mouse = -1;
|
||||||
data->unibi_ext.disable_mouse = -1;
|
data->unibi_ext.disable_mouse = -1;
|
||||||
@@ -1630,28 +1632,32 @@ static void flush_buf(UI *ui, bool toggle_cursor)
|
|||||||
uv_buf_t *bufp = bufs;
|
uv_buf_t *bufp = bufs;
|
||||||
TUIData *data = ui->data;
|
TUIData *data = ui->data;
|
||||||
|
|
||||||
if (data->bufpos <= 0) {
|
if (data->bufpos <= 0 && data->busy == data->is_invisible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toggle_cursor && !data->busy) {
|
if (toggle_cursor && !data->is_invisible) {
|
||||||
// not busy and cursor is visible, write a "cursor invisible" command
|
// cursor is visible. Write a "cursor invisible" command before writing the
|
||||||
// before writing the buffer.
|
// buffer.
|
||||||
bufp->base = data->invis;
|
bufp->base = data->invis;
|
||||||
bufp->len = data->invislen;
|
bufp->len = data->invislen;
|
||||||
bufp++;
|
bufp++;
|
||||||
|
data->is_invisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufp->base = data->buf;
|
if (data->bufpos > 0) {
|
||||||
bufp->len = data->bufpos;
|
bufp->base = data->buf;
|
||||||
bufp++;
|
bufp->len = data->bufpos;
|
||||||
|
bufp++;
|
||||||
|
}
|
||||||
|
|
||||||
if (toggle_cursor && !data->busy) {
|
if (toggle_cursor && !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;
|
||||||
bufp->len = data->normlen;
|
bufp->len = data->normlen;
|
||||||
bufp++;
|
bufp++;
|
||||||
|
data->is_invisible = data->busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_write(&req, STRUCT_CAST(uv_stream_t, &data->output_handle), bufs, (unsigned)(bufp - bufs), NULL);
|
uv_write(&req, STRUCT_CAST(uv_stream_t, &data->output_handle), bufs, (unsigned)(bufp - bufs), NULL);
|
||||||
|
Reference in New Issue
Block a user