From c881092ffe9d6760d08efcd4dfb02efcb60cc706 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 31 Oct 2023 12:05:37 +0800 Subject: fix(terminal): don't lose focus on (#25845) --- src/nvim/terminal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index a564738243..fbfe8c04a6 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -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; } -- cgit