mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
fix(terminal): fix 'mousescroll' not respected in terminal mode
(cherry picked from commit 7c0e5e68a4
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
faa5ecce93
commit
da47f6e56a
@@ -1415,8 +1415,8 @@ static bool send_mouse_event(Terminal *term, int c)
|
|||||||
int direction = c == K_MOUSEDOWN ? MSCR_DOWN : MSCR_UP;
|
int direction = c == K_MOUSEDOWN ? MSCR_DOWN : MSCR_UP;
|
||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
||||||
scroll_redraw(direction, curwin->w_botline - curwin->w_topline);
|
scroll_redraw(direction, curwin->w_botline - curwin->w_topline);
|
||||||
} else {
|
} else if (p_mousescroll_vert > 0) {
|
||||||
scroll_redraw(direction, 3L);
|
scroll_redraw(direction, p_mousescroll_vert);
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_redr_status = true;
|
curwin->w_redr_status = true;
|
||||||
|
@@ -287,7 +287,7 @@ describe(':terminal mouse', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('wont lose focus if another window is scrolled', function()
|
it("won't lose focus if another window is scrolled", function()
|
||||||
feed('<ScrollWheelUp><4,0><ScrollWheelUp><4,0>')
|
feed('<ScrollWheelUp><4,0><ScrollWheelUp><4,0>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{7: 21 }line │line30 |
|
{7: 21 }line │line30 |
|
||||||
@@ -310,6 +310,34 @@ describe(':terminal mouse', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("scrolling another window respects 'mousescroll'", function()
|
||||||
|
command('set mousescroll=ver:1')
|
||||||
|
feed('<ScrollWheelUp><4,0>')
|
||||||
|
screen:expect([[
|
||||||
|
{7: 26 }line │line30 |
|
||||||
|
{7: 27 }line │rows: 5, cols: 25 |
|
||||||
|
{7: 28 }line │rows: 5, cols: 24 |
|
||||||
|
{7: 29 }line │mouse enabled |
|
||||||
|
{7: 30 }line │{1: } |
|
||||||
|
========== ========== |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
command('set mousescroll=ver:10')
|
||||||
|
feed('<ScrollWheelUp><4,0>')
|
||||||
|
screen:expect([[
|
||||||
|
{7: 16 }line │line30 |
|
||||||
|
{7: 17 }line │rows: 5, cols: 25 |
|
||||||
|
{7: 18 }line │rows: 5, cols: 24 |
|
||||||
|
{7: 19 }line │mouse enabled |
|
||||||
|
{7: 20 }line │{1: } |
|
||||||
|
========== ========== |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
command('set mousescroll=ver:0')
|
||||||
|
feed('<ScrollWheelUp><4,0>')
|
||||||
|
screen:expect_unchanged()
|
||||||
|
end)
|
||||||
|
|
||||||
it('will lose focus if another window is clicked', function()
|
it('will lose focus if another window is clicked', function()
|
||||||
feed('<LeftMouse><5,1>')
|
feed('<LeftMouse><5,1>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
Reference in New Issue
Block a user