diff src/testdir/test_textprop.vim @ 29627:dd96f3d8ed85 v9.0.0154

patch 9.0.0154: text properties wrong after splitting a line Commit: https://github.com/vim/vim/commit/7d0f7e9524975ebcc3c7d98b5507de1b7df74370 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 6 17:10:57 2022 +0100 patch 9.0.0154: text properties wrong after splitting a line Problem: Text properties wrong after splitting a line. Solution: Check for text properties after the line. (closes https://github.com/vim/vim/issues/10857)
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Aug 2022 18:15:03 +0200
parents 78418bd45852
children 2f5610696bcd
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2450,6 +2450,41 @@ func Test_props_with_text_after_nowrap()
   call delete('XscriptPropsAfterNowrap')
 endfunc
 
+func Test_props_with_text_after_split_join()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, ['1122'])
+      call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
+      call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'})
+      exe "normal f2i\<CR>\<Esc>"
+
+      func AddMore()
+        call prop_type_add('another', #{highlight: 'Search'})
+        call prop_add(1, 0, #{type: 'another', text: ' after the text ', text_align: 'after'})
+        call prop_add(1, 0, #{type: 'another', text: ' right here', text_align: 'right'})
+      endfunc
+  END
+  call writefile(lines, 'XscriptPropsAfterSplitJoin')
+  let buf = RunVimInTerminal('-S XscriptPropsAfterSplitJoin', #{rows: 8, cols: 60})
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_1', {})
+
+  call term_sendkeys(buf, "ggJ")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_2', {})
+
+  call term_sendkeys(buf, ":call AddMore()\<CR>")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_3', {})
+
+  call term_sendkeys(buf, "ggf s\<CR>\<Esc>")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_4', {})
+
+  call term_sendkeys(buf, "ggJ")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_5', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptPropsAfterSplitJoin')
+endfunc
+
 func Test_removed_prop_with_text_cleans_up_array()
   new
   call setline(1, 'some text here')