fix(terminal): don't lose focus on <MouseMove> (#25845)

This commit is contained in:
zeertzjq
2023-10-31 12:05:37 +08:00
committed by GitHub
parent 6d1a2f2c3c
commit c881092ffe
2 changed files with 22 additions and 6 deletions

View File

@@ -1506,13 +1506,14 @@ static bool send_mouse_event(Terminal *term, int c)
return mouse_win == curwin;
}
// ignore left release action if it was not processed above
// to prevent leaving Terminal mode after entering to it using a mouse
if (c == K_LEFTRELEASE && mouse_win->w_buffer->terminal == term) {
end:
// Ignore left release action if it was not forwarded to prevent
// leaving Terminal mode after entering to it using a mouse.
if ((c == K_LEFTRELEASE && mouse_win != NULL && mouse_win->w_buffer->terminal == term)
|| c == K_MOUSEMOVE) {
return false;
}
end:
ins_char_typebuf(vgetc_char, vgetc_mod_mask);
return true;
}