Skip to content

Commit d5bc762

Browse files
luukvbaalbrammool
authored andcommitted
patch 9.0.0486: text scrolled with 'nosplitscroll', autocmd win and help
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)
1 parent 0cdfb7c commit d5bc762

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

src/testdir/test_window_cmd.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,4 +1789,34 @@ function Test_nosplitscroll_cmdwin_cursor_position()
17891789
%bwipeout!
17901790
set splitscroll&
17911791
endfunction
1792+
1793+
" No scroll when aucmd_win is opened.
1794+
function Test_nosplitscroll_aucmdwin()
1795+
set nosplitscroll
1796+
1797+
call setline(1, range(1, &lines))
1798+
norm Gzz
1799+
let top = line('w0')
1800+
call setbufvar(bufnr("test", 1) , '&buftype', 'nofile')
1801+
call assert_equal(top, line('w0'))
1802+
1803+
%bwipeout!
1804+
set splitscroll&
1805+
endfunc
1806+
1807+
" No scroll when help is closed and buffer line count < window height.
1808+
function Test_nosplitscroll_helpwin()
1809+
set nosplitscroll
1810+
set splitbelow
1811+
1812+
call setline(1, range(&lines - 10))
1813+
norm G
1814+
let top = line('w0')
1815+
help | quit
1816+
call assert_equal(top, line('w0'))
1817+
1818+
set splitbelow&
1819+
set splitscroll&
1820+
endfunc
1821+
17921822
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
486,
706708
/**/
707709
485,
708710
/**/

src/window.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ win_split_ins(
13251325
win_equal(wp, TRUE,
13261326
(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')
13271327
: dir == 'h' ? 'b' : 'v');
1328-
else if (!p_spsc)
1328+
else if (!p_spsc && wp != aucmd_win)
13291329
win_fix_scroll(FALSE);
13301330

13311331
// Don't change the window height/width to 'winheight' / 'winwidth' if a
@@ -1925,7 +1925,7 @@ win_equal(
19251925
win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,
19261926
topframe, dir, 0, tabline_height(),
19271927
(int)Columns, topframe->fr_height);
1928-
if (!p_spsc)
1928+
if (!p_spsc && next_curwin != aucmd_win)
19291929
win_fix_scroll(TRUE);
19301930
}
19311931

@@ -6366,8 +6366,7 @@ win_fix_scroll(int resize)
63666366
{
63676367
// Skip when window height has not changed or when
63686368
// buffer has less lines than the window height.
6369-
if (wp->w_height != wp->w_prev_height
6370-
&& wp->w_height < wp->w_buffer->b_ml.ml_line_count)
6369+
if (wp->w_height != wp->w_prev_height)
63716370
{
63726371
// Determine botline needed to avoid scrolling and set cursor.
63736372
if (wp->w_winrow != wp->w_prev_winrow)
@@ -7102,8 +7101,6 @@ restore_snapshot(
71027101
win_comp_pos();
71037102
if (wp != NULL && close_curwin)
71047103
win_goto(wp);
7105-
if (!p_spsc)
7106-
win_fix_scroll(FALSE);
71077104
redraw_all_later(UPD_NOT_VALID);
71087105
}
71097106
clear_snapshot(curtab, idx);

0 commit comments

Comments
 (0)