comparison src/testdir/test_autocmd.vim @ 35053:f5ebd5ee3d53 v9.1.0374

patch 9.1.0374: wrong botline in BufEnter Commit: https://github.com/vim/vim/commit/eb80b8304efb6dfeaa8d01dd41fe281df4894240 Author: Jaehwang Jung <tomtomjhj@gmail.com> Date: Fri Apr 26 18:48:48 2024 +0200 patch 9.1.0374: wrong botline in BufEnter Problem: When :edit an existing buffer, line('w$') may return a wrong result. Solution: Reset w_valid in curwin_init() (Jaehwang Jung) `do_ecmd()` reinitializes the current window (`curwin_init()`) whose `w_valid` field may have `VALID_BOTLINE` set. Resetting `w_botline` without marking it as invalid makes subsequent `validate_botline()` calls a no-op, thus resulting in wrong `line('w$')` value. closes: #14642 Signed-off-by: Jaehwang Jung <tomtomjhj@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 26 Apr 2024 19:00:03 +0200
parents f9b510d3ed32
children 92b3535e3c20
comparison
equal deleted inserted replaced
35052:37944a1bc5bf 35053:f5ebd5ee3d53
4677 endif 4677 endif
4678 4678
4679 bwipe! 4679 bwipe!
4680 endfunc 4680 endfunc
4681 4681
4682 func Test_BufEnter_botline()
4683 set hidden
4684 call writefile(range(10), 'Xxx1', 'D')
4685 call writefile(range(20), 'Xxx2', 'D')
4686 edit Xxx1
4687 edit Xxx2
4688 au BufEnter Xxx1 call assert_true(line('w$') > 1)
4689 edit Xxx1
4690 au! BufEnter Xxx1
4691 set hidden&vim
4692 endfunc
4693
4682 " vim: shiftwidth=2 sts=2 expandtab 4694 " vim: shiftwidth=2 sts=2 expandtab