mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(tui): don't forget to update cursor visibility (#26523)
This commit is contained in:
parent
8097b4a725
commit
b76cc974b9
@ -2255,6 +2255,11 @@ static void augment_terminfo(TUIData *tui, const char *term, int vte_version, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool should_invisible(TUIData *tui)
|
||||||
|
{
|
||||||
|
return tui->busy || tui->want_invisible;
|
||||||
|
}
|
||||||
|
|
||||||
/// Write the sequence to begin flushing output to `buf`.
|
/// Write the sequence to begin flushing output to `buf`.
|
||||||
/// If 'termsync' is set and the terminal supports synchronized output, begin synchronized update.
|
/// If 'termsync' is set and the terminal supports synchronized output, begin synchronized update.
|
||||||
/// Otherwise, hide the cursor to avoid cursor jumping.
|
/// Otherwise, hide the cursor to avoid cursor jumping.
|
||||||
@ -2298,11 +2303,10 @@ static size_t flush_buf_end(TUIData *tui, char *buf, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
bool should_invisible = tui->busy || tui->want_invisible;
|
if (tui->is_invisible && !should_invisible(tui)) {
|
||||||
if (tui->is_invisible && !should_invisible) {
|
|
||||||
str = unibi_get_str(tui->ut, unibi_cursor_normal);
|
str = unibi_get_str(tui->ut, unibi_cursor_normal);
|
||||||
tui->is_invisible = false;
|
tui->is_invisible = false;
|
||||||
} else if (!tui->is_invisible && should_invisible) {
|
} else if (!tui->is_invisible && should_invisible(tui)) {
|
||||||
str = unibi_get_str(tui->ut, unibi_cursor_invisible);
|
str = unibi_get_str(tui->ut, unibi_cursor_invisible);
|
||||||
tui->is_invisible = true;
|
tui->is_invisible = true;
|
||||||
}
|
}
|
||||||
@ -2322,7 +2326,7 @@ static void flush_buf(TUIData *tui)
|
|||||||
char pre[32];
|
char pre[32];
|
||||||
char post[32];
|
char post[32];
|
||||||
|
|
||||||
if (tui->bufpos <= 0) {
|
if (tui->bufpos <= 0 && tui->is_invisible == should_invisible(tui)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1714,6 +1714,36 @@ describe('TUI', function()
|
|||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('cursor is not hidden on incsearch with no match', function()
|
||||||
|
feed_data('ifoo\027')
|
||||||
|
feed_data('/foo')
|
||||||
|
screen:expect([[
|
||||||
|
{1:foo} |
|
||||||
|
{4:~ }|*3
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
/foo{1: } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
screen:sleep(10)
|
||||||
|
feed_data('b')
|
||||||
|
screen:expect([[
|
||||||
|
foo |
|
||||||
|
{4:~ }|*3
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
/foob{1: } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
screen:sleep(10)
|
||||||
|
feed_data('a')
|
||||||
|
screen:expect([[
|
||||||
|
foo |
|
||||||
|
{4:~ }|*3
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
/fooba{1: } |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('TUI', function()
|
describe('TUI', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user