From 62ecb05957f43b140e7dd874e1f84e3a6fa99838 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 3 May 2023 07:21:09 +0800 Subject: vim-patch:9.0.1506: line number not displayed when using 'smoothscroll' (#23453) Problem: Line number not displayed when using 'smoothscroll'. Solution: Adjust condition for showing the line number. (closes vim/vim#12333) https://github.com/vim/vim/commit/88bb3e0a48f160134bdea98cd2b8bd3af86f9d6f --- test/functional/ui/diff_spec.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index dbdf3823ec..0f551e3044 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1325,6 +1325,7 @@ it('win_update redraws lines properly', function() ]]} end) +-- oldtest: Test_diff_rnu() it('diff updates line numbers below filler lines', function() clear() local screen = Screen.new(40, 14) @@ -1401,6 +1402,7 @@ it('diff updates line numbers below filler lines', function() ]]) end) +-- oldtest: Test_diff_with_scroll_and_change() it('Align the filler lines when changing text in diff mode', function() clear() local screen = Screen.new(40, 20) -- cgit From 008154954791001efcc46c28146e21403f3a698b Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 21 Aug 2023 14:52:17 +0200 Subject: refactor(change): do API changes to buffer without curbuf switch Most of the messy things when changing a non-current buffer is not about the buffer, it is about windows. In particular, it is about `curwin`. When editing a non-current buffer which is displayed in some other window in the current tabpage, one such window will be "borrowed" as the curwin. But this means if two or more non-current windows displayed the buffers, one of them will be treated differenty. this is not desirable. In particular, with nvim_buf_set_text, cursor _column_ position was only corrected for one single window. Two new tests are added: the test with just one non-current window passes, but the one with two didn't. Two corresponding such tests were also added for nvim_buf_set_lines. This already worked correctly on master, but make sure this is well-tested for future refactors. Also, nvim_create_buf no longer invokes autocmds just because you happened to use `scratch=true`. No option value was changed, therefore OptionSet must not be fired. --- test/functional/ui/diff_spec.lua | 92 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 0f551e3044..92b7235885 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1251,6 +1251,98 @@ AAAB]] ]]} end) end) + + it('redraws with a change to non-current buffer', function() + write_file(fname, "aaa\nbbb\nccc\n\nxx", false) + write_file(fname_2, "aaa\nbbb\nccc\n\nyy", false) + reread() + local buf = meths.get_current_buf() + command('botright new') + screen:expect{grid=[[ + {1: }aaa │{1: }aaa | + {1: }bbb │{1: }bbb | + {1: }ccc │{1: }ccc | + {1: } │{1: } | + {1: }{8:xx}{9: }│{1: }{8:yy}{9: }| + {6:~ }│{6:~ }| + {3: