mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(terminal): keep focus when scrolling number column of another window (#25848)
This commit is contained in:
@@ -1417,13 +1417,14 @@ static void mouse_action(Terminal *term, int button, int row, int col, bool pres
|
|||||||
static bool send_mouse_event(Terminal *term, int c)
|
static bool send_mouse_event(Terminal *term, int c)
|
||||||
{
|
{
|
||||||
int row = mouse_row, col = mouse_col, grid = mouse_grid;
|
int row = mouse_row, col = mouse_col, grid = mouse_grid;
|
||||||
int offset;
|
|
||||||
win_T *mouse_win = mouse_find_win(&grid, &row, &col);
|
win_T *mouse_win = mouse_find_win(&grid, &row, &col);
|
||||||
if (mouse_win == NULL || (offset = win_col_off(mouse_win)) > col) {
|
if (mouse_win == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term->forward_mouse && mouse_win->w_buffer->terminal == term) {
|
int offset;
|
||||||
|
if (term->forward_mouse && mouse_win->w_buffer->terminal == term
|
||||||
|
&& col >= (offset = win_col_off(mouse_win))) {
|
||||||
// event in the terminal window and mouse events was enabled by the
|
// event in the terminal window and mouse events was enabled by the
|
||||||
// program. translate and forward the event
|
// program. translate and forward the event
|
||||||
int button;
|
int button;
|
||||||
|
@@ -324,7 +324,7 @@ describe(':terminal mouse', function()
|
|||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
command('set mousescroll=ver:10')
|
command('set mousescroll=ver:10')
|
||||||
feed('<ScrollWheelUp><4,0>')
|
feed('<ScrollWheelUp><0,0>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{7: 16 }line │line30 |
|
{7: 16 }line │line30 |
|
||||||
{7: 17 }line │rows: 5, cols: 25 |
|
{7: 17 }line │rows: 5, cols: 25 |
|
||||||
@@ -335,7 +335,7 @@ describe(':terminal mouse', function()
|
|||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
command('set mousescroll=ver:0')
|
command('set mousescroll=ver:0')
|
||||||
feed('<ScrollWheelUp><4,0>')
|
feed('<ScrollWheelUp><0,0>')
|
||||||
screen:expect_unchanged()
|
screen:expect_unchanged()
|
||||||
feed([[<C-\><C-N><C-W>w]])
|
feed([[<C-\><C-N><C-W>w]])
|
||||||
command('setlocal nowrap')
|
command('setlocal nowrap')
|
||||||
|
Reference in New Issue
Block a user