diff src/testdir/test_textprop.vim @ 29718:538204fce2a4 v9.0.0199

patch 9.0.0199: cursor position wrong with two right-aligned virtual texts Commit: https://github.com/vim/vim/commit/f0ccfa474a5c4940d03bfc6084e896dc8ac2d791 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 13 16:41:19 2022 +0100 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts Problem: Cursor position wrong with two right-aligned virtual texts. Solution: Add the padding for right-alignment. (issue https://github.com/vim/vim/issues/10906)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Aug 2022 17:45:03 +0200
parents d97b2ce26258
children bf965640744d
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2538,6 +2538,29 @@ func Test_prop_inserts_text_highlight()
   call delete('XscriptPropsWithHighlight')
 endfunc
 
+func Test_props_with_text_right_align_twice()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, ["some text some text some text some text", 'line two'])
+      call prop_type_add( 'MyErrorText', #{ highlight: 'ErrorMsg' } )
+      call prop_type_add( 'MyPadding', #{ highlight: 'DiffChange' } )
+      call prop_add( 1, 0, #{ type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'} )
+      call prop_add( 1, 0, #{ type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right' } )
+      call prop_add( 1, 0, #{ type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right' } )
+      normal G$
+  END
+  call writefile(lines, 'XscriptPropsRightAlign')
+  let buf = RunVimInTerminal('-S XscriptPropsRightAlign', #{rows: 8})
+  call VerifyScreenDump(buf, 'Test_prop_right_align_twice_1', {})
+
+  call term_sendkeys(buf, "ggisome more text\<Esc>G$")
+  call VerifyScreenDump(buf, 'Test_prop_right_align_twice_2', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptPropsRightAlign')
+endfunc
+
 func Test_props_with_text_after()
   CheckRunVimInTerminal