From 6dab00aa5417f62f8c2c85c7c4ae871b4f1171f4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 20 May 2022 13:45:59 +0100 Subject: [PATCH] patch 8.2.4984: dragging statusline fails for window with winbar Problem: Dragging statusline fails for window with winbar. Solution: Fix off-by-one error. (closes #10448) --- src/mouse.c | 2 +- src/testdir/test_winbar.vim | 28 ++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/mouse.c b/src/mouse.c index af9186d72..58c4ab4ec 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1823,7 +1823,7 @@ retnomove: 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; diff --git a/src/testdir/test_winbar.vim b/src/testdir/test_winbar.vim index 92da3128f..7972bc3b6 100644 --- a/src/testdir/test_winbar.vim +++ b/src/testdir/test_winbar.vim @@ -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("\", 'xt') + call test_setmouse(&lines - 2, 1) + call feedkeys("\", 'xt') + call assert_equal(2, &cmdheight) + + call test_setmouse(&lines - 2, 1) + call feedkeys("\", 'xt') + call test_setmouse(&lines - 3, 1) + call feedkeys("\", 'xt') + call assert_equal(3, &cmdheight) + + call test_setmouse(&lines - 3, 1) + call feedkeys("\", 'xt') + call test_setmouse(&lines - 1, 1) + call feedkeys("\", 'xt') + call assert_equal(1, &cmdheight) + + let &mouse = save_mouse + set laststatus& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 1ac456029..40b81d1f3 100644 --- a/src/version.c +++ b/src/version.c @@ -746,6 +746,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 4984, /**/ 4983, /**/