Skip to content

Commit

Permalink
patch 8.2.4984: dragging statusline fails for window with winbar
Browse files Browse the repository at this point in the history
Problem:    Dragging statusline fails for window with winbar.
Solution:   Fix off-by-one error. (closes #10448)
  • Loading branch information
zeertzjq authored and brammool committed May 20, 2022
1 parent b0855f5 commit 6dab00a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ jump_to_mouse(
if (dragwin != NULL)
{
// Drag the status line
count = row - dragwin->w_winrow - dragwin->w_height + 1
count = row - W_WINROW(dragwin) - dragwin->w_height + 1
- on_status_line;
win_drag_status_line(dragwin, count);
did_drag |= count;
Expand Down
28 changes: 28 additions & 0 deletions src/testdir/test_winbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,32 @@ func Test_winbar_not_visible_custom_statusline()
call delete('XtestWinbarNotVisble')
endfunction

func Test_drag_statusline_with_winbar()
call SetupWinbar()
let save_mouse = &mouse
set mouse=a
set laststatus=2

call test_setmouse(&lines - 1, 1)
call feedkeys("\<LeftMouse>", 'xt')
call test_setmouse(&lines - 2, 1)
call feedkeys("\<LeftDrag>", 'xt')
call assert_equal(2, &cmdheight)

call test_setmouse(&lines - 2, 1)
call feedkeys("\<LeftMouse>", 'xt')
call test_setmouse(&lines - 3, 1)
call feedkeys("\<LeftDrag>", 'xt')
call assert_equal(3, &cmdheight)

call test_setmouse(&lines - 3, 1)
call feedkeys("\<LeftMouse>", 'xt')
call test_setmouse(&lines - 1, 1)
call feedkeys("\<LeftDrag>", 'xt')
call assert_equal(1, &cmdheight)

let &mouse = save_mouse
set laststatus&
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4984,
/**/
4983,
/**/
Expand Down

0 comments on commit 6dab00a

Please sign in to comment.