mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
terminal: Avoid unnecessary redraws.
This commit is contained in:
parent
857113ca8c
commit
3aedf9d669
@ -1003,9 +1003,12 @@ static void refresh_timer_cb(TimeWatcher *watcher, void *data)
|
|||||||
map_foreach(invalidated_terminals, term, stub, {
|
map_foreach(invalidated_terminals, term, stub, {
|
||||||
refresh_terminal(term);
|
refresh_terminal(term);
|
||||||
});
|
});
|
||||||
|
bool any_visible = is_term_visible();
|
||||||
pmap_clear(ptr_t)(invalidated_terminals);
|
pmap_clear(ptr_t)(invalidated_terminals);
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
redraw(true);
|
if (any_visible) {
|
||||||
|
redraw(true);
|
||||||
|
}
|
||||||
end:
|
end:
|
||||||
refresh_pending = false;
|
refresh_pending = false;
|
||||||
}
|
}
|
||||||
@ -1119,6 +1122,18 @@ static void refresh_screen(Terminal *term, buf_T *buf)
|
|||||||
term->invalid_end = -1;
|
term->invalid_end = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return true if any invalidated terminal buffer is visible to the user
|
||||||
|
static bool is_term_visible(void)
|
||||||
|
{
|
||||||
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
|
if (wp->w_buffer->terminal
|
||||||
|
&& pmap_has(ptr_t)(invalidated_terminals, wp->w_buffer->terminal)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void redraw(bool restore_cursor)
|
static void redraw(bool restore_cursor)
|
||||||
{
|
{
|
||||||
Terminal *term = curbuf->terminal;
|
Terminal *term = curbuf->terminal;
|
||||||
|
Loading…
Reference in New Issue
Block a user