mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(terminal): don't lose focus on <MouseMove> (#25845)
This commit is contained in:
parent
6d1a2f2c3c
commit
c881092ffe
@ -1506,13 +1506,14 @@ static bool send_mouse_event(Terminal *term, int c)
|
|||||||
return mouse_win == curwin;
|
return mouse_win == curwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore left release action if it was not processed above
|
end:
|
||||||
// to prevent leaving Terminal mode after entering to it using a mouse
|
// Ignore left release action if it was not forwarded to prevent
|
||||||
if (c == K_LEFTRELEASE && mouse_win->w_buffer->terminal == term) {
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
ins_char_typebuf(vgetc_char, vgetc_mod_mask);
|
ins_char_typebuf(vgetc_char, vgetc_mod_mask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,23 @@ describe(':terminal mouse', function()
|
|||||||
eq('nt', eval('mode(1)'))
|
eq('nt', eval('mode(1)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not leave terminal mode on left-release', function()
|
it('will not exit focus on left-release', function()
|
||||||
feed('<LeftRelease>')
|
eq('t', eval('mode(1)'))
|
||||||
|
feed('<LeftRelease><0,0>')
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
command('setlocal number')
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
feed('<LeftRelease><0,0>')
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('will not exit focus on mouse movement', function()
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
feed('<MouseMove><0,0>')
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
command('setlocal number')
|
||||||
|
eq('t', eval('mode(1)'))
|
||||||
|
feed('<MouseMove><0,0>')
|
||||||
eq('t', eval('mode(1)'))
|
eq('t', eval('mode(1)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user