commit 257765d9e0f20dc060f496ed400b16203e44dc9c
parent 05d3bef8364c93b205fd47398420dcd705df2714
Author: bfredl <bjorn.linse@gmail.com>
Date: Thu, 9 Feb 2023 20:55:35 +0100
refactor(ui): don't reimplement redrawing in focus gained handling
These are just ordinary boring events now. Modes already redraw events
themselves.
Diffstat:
1 file changed, 2 insertions(+), 26 deletions(-)
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
@@ -2740,14 +2740,12 @@ void do_autocmd_focusgained(bool gained)
{
static bool recursive = false;
static Timestamp last_time = (time_t)0;
- bool need_redraw = false;
if (recursive) {
return; // disallow recursion
}
recursive = true;
- need_redraw |= apply_autocmds((gained ? EVENT_FOCUSGAINED : EVENT_FOCUSLOST),
- NULL, NULL, false, curbuf);
+ apply_autocmds((gained ? EVENT_FOCUSGAINED : EVENT_FOCUSLOST), NULL, NULL, false, curbuf);
// When activated: Check if any file was modified outside of Vim.
// Only do this when not done within the last two seconds as:
@@ -2755,32 +2753,10 @@ void do_autocmd_focusgained(bool gained)
// has a granularity of 2 seconds.
// 2. We could get multiple notifications in a row.
if (gained && last_time + (Timestamp)2000 < os_now()) {
- need_redraw = check_timestamps(true);
+ check_timestamps(true);
last_time = os_now();
}
- if (need_redraw) {
- // Something was executed, make sure the cursor is put back where it
- // belongs.
- need_wait_return = false;
-
- if (State & MODE_CMDLINE) {
- redrawcmdline();
- } else if ((State & MODE_NORMAL) || (State & MODE_INSERT)) {
- if (must_redraw != 0) {
- update_screen();
- }
-
- setcursor();
- }
-
- ui_flush();
- }
-
- if (need_maketitle) {
- maketitle();
- }
-
recursive = false;
}