mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tui: Don't call uv_write without output (#12146)
Fixes #11653, #11990. Check for cursor visibility to toggle uv_write call.
This commit is contained in:
parent
adec9fb444
commit
8745247cba
@ -1973,7 +1973,23 @@ static void flush_buf(UI *ui)
|
|||||||
uv_buf_t *bufp = &bufs[0];
|
uv_buf_t *bufp = &bufs[0];
|
||||||
TUIData *data = ui->data;
|
TUIData *data = ui->data;
|
||||||
|
|
||||||
if (data->bufpos <= 0 && data->busy == data->is_invisible) {
|
// The content of the output for each condition is shown in the following
|
||||||
|
// table. Therefore, if data->bufpos == 0 and N/A or invis + norm, there is
|
||||||
|
// no need to output it.
|
||||||
|
//
|
||||||
|
// | is_invisible | !is_invisible
|
||||||
|
// ------+-----------------+--------------+---------------
|
||||||
|
// busy | want_invisible | N/A | invis
|
||||||
|
// | !want_invisible | N/A | invis
|
||||||
|
// ------+-----------------+--------------+---------------
|
||||||
|
// !busy | want_invisible | N/A | invis
|
||||||
|
// | !want_invisible | norm | invis + norm
|
||||||
|
// ------+-----------------+--------------+---------------
|
||||||
|
//
|
||||||
|
if (data->bufpos <= 0
|
||||||
|
&& ((data->is_invisible && data->busy)
|
||||||
|
|| (data->is_invisible && !data->busy && data->want_invisible)
|
||||||
|
|| (!data->is_invisible && !data->busy && !data->want_invisible))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2000,9 +2016,9 @@ static void flush_buf(UI *ui)
|
|||||||
bufp->base = data->norm;
|
bufp->base = data->norm;
|
||||||
bufp->len = UV_BUF_LEN(data->normlen);
|
bufp->len = UV_BUF_LEN(data->normlen);
|
||||||
bufp++;
|
bufp++;
|
||||||
}
|
|
||||||
data->is_invisible = false;
|
data->is_invisible = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uv_write(&req, STRUCT_CAST(uv_stream_t, &data->output_handle),
|
uv_write(&req, STRUCT_CAST(uv_stream_t, &data->output_handle),
|
||||||
bufs, (unsigned)(bufp - bufs), NULL);
|
bufs, (unsigned)(bufp - bufs), NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user