summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2022-09-17 16:16:35 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-17 16:16:35 +0100
commitd5bc762dea1fd32fa04342f8149f95ccfc3b9709 (patch)
tree4818f726c9be293c96bb9f871a400b6a5c265273
parent0cdfb7ce462393595b0308dcabf343e82f05319d (diff)
downloadvim-git-d5bc762dea1fd32fa04342f8149f95ccfc3b9709.tar.gz
patch 9.0.0486: text scrolled with 'nosplitscroll', autocmd win and helpv9.0.0486
Problem: Text scrolled with 'nosplitscroll', autocmd win opened and help window closed. Solution: Skip win_fix_scroll() in more situations. (Luuk van Baal, closes #11150)
-rw-r--r--src/testdir/test_window_cmd.vim30
-rw-r--r--src/version.c2
-rw-r--r--src/window.c9
3 files changed, 35 insertions, 6 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index d0be91ed7..e04440405 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1789,4 +1789,34 @@ function Test_nosplitscroll_cmdwin_cursor_position()
%bwipeout!
set splitscroll&
endfunction
+
+" No scroll when aucmd_win is opened.
+function Test_nosplitscroll_aucmdwin()
+ set nosplitscroll
+
+ call setline(1, range(1, &lines))
+ norm Gzz
+ let top = line('w0')
+ call setbufvar(bufnr("test", 1) , '&buftype', 'nofile')
+ call assert_equal(top, line('w0'))
+
+ %bwipeout!
+ set splitscroll&
+endfunc
+
+" No scroll when help is closed and buffer line count < window height.
+function Test_nosplitscroll_helpwin()
+ set nosplitscroll
+ set splitbelow
+
+ call setline(1, range(&lines - 10))
+ norm G
+ let top = line('w0')
+ help | quit
+ call assert_equal(top, line('w0'))
+
+ set splitbelow&
+ set splitscroll&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 2c9fac2e8..2ce61d574 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 486,
+/**/
485,
/**/
484,
diff --git a/src/window.c b/src/window.c
index 2e4a80678..3ed3f5a9d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1325,7 +1325,7 @@ win_split_ins(
win_equal(wp, TRUE,
(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')
: dir == 'h' ? 'b' : 'v');
- else if (!p_spsc)
+ else if (!p_spsc && wp != aucmd_win)
win_fix_scroll(FALSE);
// Don't change the window height/width to 'winheight' / 'winwidth' if a
@@ -1925,7 +1925,7 @@ win_equal(
win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,
topframe, dir, 0, tabline_height(),
(int)Columns, topframe->fr_height);
- if (!p_spsc)
+ if (!p_spsc && next_curwin != aucmd_win)
win_fix_scroll(TRUE);
}
@@ -6366,8 +6366,7 @@ win_fix_scroll(int resize)
{
// Skip when window height has not changed or when
// buffer has less lines than the window height.
- if (wp->w_height != wp->w_prev_height
- && wp->w_height < wp->w_buffer->b_ml.ml_line_count)
+ if (wp->w_height != wp->w_prev_height)
{
// Determine botline needed to avoid scrolling and set cursor.
if (wp->w_winrow != wp->w_prev_winrow)
@@ -7102,8 +7101,6 @@ restore_snapshot(
win_comp_pos();
if (wp != NULL && close_curwin)
win_goto(wp);
- if (!p_spsc)
- win_fix_scroll(FALSE);
redraw_all_later(UPD_NOT_VALID);
}
clear_snapshot(curtab, idx);