diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-02 05:52:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-02 05:58:51 +0800 |
commit | 4f576be881a590172fa620214af6c9a42e98d132 (patch) | |
tree | 7e2becd5a1aefff1e9fbbb11ab12e9449d7081d8 | |
parent | c57c25649be1d942a7f9ad78e26ac221a3239099 (diff) | |
download | rneovim-4f576be881a590172fa620214af6c9a42e98d132.tar.gz rneovim-4f576be881a590172fa620214af6c9a42e98d132.tar.bz2 rneovim-4f576be881a590172fa620214af6c9a42e98d132.zip |
vim-patch:8.2.4956: reading past end of line with "gf" in Visual block mode
Problem: Reading past end of line with "gf" in Visual block mode.
Solution: Do not include the NUL in the length.
https://github.com/vim/vim/commit/395bd1f6d3edc9f7edb5d1f2d7deaf5a9e3ab93c
Omit trailing space: removed in patch 9.0.0126.
-rw-r--r-- | src/nvim/testdir/test_gf.vim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index c48e56976e..feae44e5ee 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -138,6 +138,22 @@ func Test_gf_visual() call assert_equal('Xtest_gf_visual', bufname('%')) call assert_equal(3, getcurpos()[1]) + " do not include the NUL at the end + call writefile(['x'], 'X') + let save_enc = &enc + " for enc in ['latin1', 'utf-8'] + for enc in ['utf-8'] + exe "set enc=" .. enc + new + call setline(1, 'X') + set nomodified + exe "normal \<C-V>$gf" + call assert_equal('X', bufname()) + bwipe! + endfor + let &enc = save_enc + call delete('X') + " line number in visual area is used for file name if has('unix') bwipe! |