098_scrollbind_spec.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Test for 'scrollbind' causing an unexpected scroll of one of the windows.
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local source = helpers.source
  4. local clear, expect = helpers.clear, helpers.expect
  5. describe('scrollbind', function()
  6. setup(clear)
  7. it('is working', function()
  8. source([[
  9. set laststatus=0
  10. let g:totalLines = &lines * 20
  11. let middle = g:totalLines / 2
  12. wincmd n
  13. wincmd o
  14. for i in range(1, g:totalLines)
  15. call setline(i, 'LINE ' . i)
  16. endfor
  17. exe string(middle)
  18. normal zt
  19. normal M
  20. aboveleft vert new
  21. for i in range(1, g:totalLines)
  22. call setline(i, 'line ' . i)
  23. endfor
  24. exe string(middle)
  25. normal zt
  26. normal M
  27. setl scb | wincmd p
  28. setl scb
  29. wincmd w
  30. let topLineLeft = line('w0')
  31. wincmd p
  32. let topLineRight = line('w0')
  33. setl noscrollbind
  34. wincmd p
  35. setl noscrollbind
  36. q!
  37. %del _
  38. call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight))
  39. brewind
  40. ]])
  41. -- Assert buffer contents.
  42. expect("Difference between the top lines (left - right): 0")
  43. end)
  44. end)