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 #10857)
diff --git a/src/testdir/dumps/Test_prop_with_text_after_join_split_1.dump b/src/testdir/dumps/Test_prop_with_text_after_join_split_1.dump
new file mode 100644
index 0000000..4aab0b1
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_join_split_1.dump
@@ -0,0 +1,8 @@
+|1+0&#ffffff0@1| @57
+>2@1| @57
+| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_after_join_split_2.dump b/src/testdir/dumps/Test_prop_with_text_after_join_split_2.dump
new file mode 100644
index 0000000..d17aacf
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_join_split_2.dump
@@ -0,0 +1,8 @@
+|1+0&#ffffff0@1> |2@1| @54
+| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|1|,|3| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_after_join_split_3.dump b/src/testdir/dumps/Test_prop_with_text_after_join_split_3.dump
new file mode 100644
index 0000000..51a397f
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_join_split_3.dump
@@ -0,0 +1,8 @@
+|1+0&#ffffff0@1> |2@1| +0&#ffff4012|a|f|t|e|r| |t|h|e| |t|e|x|t| | +0&#ffffff0@27| +0&#ffff4012|r|i|g|h|t| |h|e|r|e
+| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|:+0#0000000&|c|a|l@1| |A|d@1|M|o|r|e|(|)| @26|1|,|3| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_after_join_split_4.dump b/src/testdir/dumps/Test_prop_with_text_after_join_split_4.dump
new file mode 100644
index 0000000..7ec94b1
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_join_split_4.dump
@@ -0,0 +1,8 @@
+|1+0&#ffffff0@1| @57
+>2@1| +0&#ffff4012|a|f|t|e|r| |t|h|e| |t|e|x|t| | +0&#ffffff0@30| +0&#ffff4012|r|i|g|h|t| |h|e|r|e
+| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_after_join_split_5.dump b/src/testdir/dumps/Test_prop_with_text_after_join_split_5.dump
new file mode 100644
index 0000000..991b64d
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_after_join_split_5.dump
@@ -0,0 +1,8 @@
+|1+0&#ffffff0@1> |2@1| +0&#ffff4012|a|f|t|e|r| |t|h|e| |t|e|x|t| | +0&#ffffff0@27| +0&#ffff4012|r|i|g|h|t| |h|e|r|e
+| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|1|,|3| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index dfead1d..505d056 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2450,6 +2450,41 @@
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')