patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Problem: Cursor position wrong with wrapping virtual text in empty line.
Solution: Adjust handling of an empty line. (closes #10875)
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_1.dump b/src/testdir/dumps/Test_prop_with_text_empty_line_1.dump
new file mode 100644
index 0000000..426d64e
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_1.dump
@@ -0,0 +1,8 @@
+>X+0&#ffff4012@59
+|a+0&#ffffff0@2| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+| +0#0000000&@41|1|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_2.dump b/src/testdir/dumps/Test_prop_with_text_empty_line_2.dump
new file mode 100644
index 0000000..426d64e
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_2.dump
@@ -0,0 +1,8 @@
+>X+0&#ffff4012@59
+|a+0&#ffffff0@2| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+| +0#0000000&@41|1|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_3.dump b/src/testdir/dumps/Test_prop_with_text_empty_line_3.dump
new file mode 100644
index 0000000..3e3e9ea
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_3.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+|a+0&#ffffff0@1>a| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+| +0#0000000&@41|2|,|3| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_4.dump b/src/testdir/dumps/Test_prop_with_text_empty_line_4.dump
new file mode 100644
index 0000000..8689ac4
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_4.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+|a+0&#ffffff0@2| @56
+>X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+| +0#0000000&@41|3|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_5.dump b/src/testdir/dumps/Test_prop_with_text_empty_line_5.dump
new file mode 100644
index 0000000..9ea16dc
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_5.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+|a+0&#ffffff0@2| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@4>b| @53
+|~+0#4040ff13&| @58
+|~| @58
+| +0#0000000&@41|4|,|6| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index caf933d..f60eb83 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2557,6 +2557,32 @@
call delete('XscriptPropsWithTextAfterTrunc')
endfunc
+func Test_props_with_text_empty_line()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, ['', 'aaa', '', 'bbbbbb'])
+ call prop_type_add('prop1', #{highlight: 'Search'})
+ call prop_add(1, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns)})
+ call prop_add(3, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns + 1)})
+ normal gg0
+ END
+ call writefile(lines, 'XscriptPropsWithTextEmptyLine')
+ let buf = RunVimInTerminal('-S XscriptPropsWithTextEmptyLine', #{rows: 8, cols: 60})
+ call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_1', {})
+ call term_sendkeys(buf, "$")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_2', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_3', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_4', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_5', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptPropsWithTextEmptyLine')
+endfunc
+
func Test_props_with_text_after_wraps()
CheckRunVimInTerminal