blob: baa24f197940173c8b8ef7aac8482b20e23dc70a [file] [log] [blame]
Bram Moolenaar4a137b42017-08-04 22:37:11 +02001" Test for 'scrollbind' causing an unexpected scroll of one of the windows.
2func Test_scrollbind()
3 " We don't want the status line to cause problems:
4 set laststatus=0
5 let totalLines = &lines * 20
6 let middle = totalLines / 2
7 new | only
8 for i in range(1, totalLines)
9 call setline(i, 'LINE ' . i)
10 endfor
11 exe string(middle)
12 normal zt
13 normal M
14 aboveleft vert new
15 for i in range(1, totalLines)
16 call setline(i, 'line ' . i)
17 endfor
18 exe string(middle)
19 normal zt
20 normal M
21 " Execute the following two commands at once to reproduce the problem.
22 setl scb | wincmd p
23 setl scb
24 wincmd w
25 let topLineLeft = line('w0')
26 wincmd p
27 let topLineRight = line('w0')
28 setl noscrollbind
29 wincmd p
30 setl noscrollbind
31 call assert_equal(0, topLineLeft - topLineRight)
32endfunc