aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-06 06:49:23 +0800
committerGitHub <noreply@github.com>2024-10-06 06:49:23 +0800
commit9f26bdc4165adf7de9bf0c231a386b02e85cbce0 (patch)
tree4fa1c30eae559986dcf408b60bdef3ed974ed7f1 /test
parent8801b77ed09876605e42f4a3fddf8c020c14b711 (diff)
downloadrneovim-9f26bdc4165adf7de9bf0c231a386b02e85cbce0.tar.gz
rneovim-9f26bdc4165adf7de9bf0c231a386b02e85cbce0.tar.bz2
rneovim-9f26bdc4165adf7de9bf0c231a386b02e85cbce0.zip
vim-patch:9.1.0759: screenpos() may return invalid position (#30681)
Problem: screenpos() may return invalid position after switching buffers (Greg Hurrell) Solution: reset w_leftcol if wrapping has been set after copying wrap option fixes: vim/vim#15792 closes: vim/vim#15803 https://github.com/vim/vim/commit/b065a10e245d020c11b521a2a5062300ca9891fc Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_cursor_func.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/old/testdir/test_cursor_func.vim b/test/old/testdir/test_cursor_func.vim
index 5d99963814..99af0ab359 100644
--- a/test/old/testdir/test_cursor_func.vim
+++ b/test/old/testdir/test_cursor_func.vim
@@ -279,6 +279,21 @@ func Test_screenpos_number()
bwipe!
endfunc
+func Test_screenpos_edit_newfile()
+ new
+ 20vsp
+ setl nowrap
+ call setline(1, 'abcdefghijklmnopqrstuvwxyz')
+ call cursor(1, 10)
+ norm! 5zl
+ call assert_equal(#{col: 5, row: 1, endcol: 5, curscol: 5}, screenpos(win_getid(), 1, 10))
+ enew!
+ call assert_equal(1, &l:wrap)
+ call assert_equal(#{col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1))
+
+ bwipe!
+endfunc
+
" Save the visual start character position
func SaveVisualStartCharPos()
call add(g:VisualStartPos, getcharpos('v'))