diff src/testdir/test_cursor_func.vim @ 28419:6e501ecd1bb7 v8.2.4734

patch 8.2.4734: getcharpos() may change a mark position Commit: https://github.com/vim/vim/commit/3caf1cce2b85a8f24195d057f0ad63082543e99e Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 11 13:05:16 2022 +0100 patch 8.2.4734: getcharpos() may change a mark position Problem: getcharpos() may change a mark position. Solution: Copy the mark position. (closes https://github.com/vim/vim/issues/10148)
author Bram Moolenaar <Bram@vim.org>
date Mon, 11 Apr 2022 14:15:04 +0200
parents d3ed8b1a7bde
children 9f25e0ed831d
line wrap: on
line diff
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -188,12 +188,12 @@ func Test_getcharpos()
   call assert_fails('call getcharpos({})', 'E731:')
   call assert_equal([0, 0, 0, 0], getcharpos(0))
   new
-  call setline(1, ['', "01\tà4è678", 'Ⅵ', '012345678'])
+  call setline(1, ['', "01\tà4è678", 'Ⅵ', '012345678', ' │  x'])
 
   " Test for '.' and '$'
   normal 1G
   call assert_equal([0, 1, 1, 0], getcharpos('.'))
-  call assert_equal([0, 4, 1, 0], getcharpos('$'))
+  call assert_equal([0, 5, 1, 0], getcharpos('$'))
   normal 2G6l
   call assert_equal([0, 2, 7, 0], getcharpos('.'))
   normal 3G$
@@ -207,6 +207,12 @@ func Test_getcharpos()
   delmarks m
   call assert_equal([0, 0, 0, 0], getcharpos("'m"))
 
+  " Check mark does not move
+  normal 5Gfxma
+  call assert_equal([0, 5, 5, 0], getcharpos("'a"))
+  call assert_equal([0, 5, 5, 0], getcharpos("'a"))
+  call assert_equal([0, 5, 5, 0], getcharpos("'a"))
+
   " Test for the visual start column
   vnoremap <expr> <F3> SaveVisualStartCharPos()
   let g:VisualStartPos = []