patch 9.0.0178: cursor position wrong with virtual text before Tab

Problem:    Cursor position wrong with virtual text before Tab.
Solution:   Use the byte length, not the cell with, to compare the column.
            Correct tab size after text prop. (closes #10866)
diff --git a/src/testdir/dumps/Test_prop_before_tab_01.dump b/src/testdir/dumps/Test_prop_before_tab_01.dump
new file mode 100644
index 0000000..a0c264e
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_01.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@3> |x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1|-|8| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_02.dump b/src/testdir/dumps/Test_prop_before_tab_02.dump
new file mode 100644
index 0000000..4aab872
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_02.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4>x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|2|-|9| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_03.dump b/src/testdir/dumps/Test_prop_before_tab_03.dump
new file mode 100644
index 0000000..f89f0b9
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_03.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7> +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|2|,|1|-|8| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_04.dump b/src/testdir/dumps/Test_prop_before_tab_04.dump
new file mode 100644
index 0000000..a820a41
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_04.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0>x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|2|,|2|-|9| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_05.dump b/src/testdir/dumps/Test_prop_before_tab_05.dump
new file mode 100644
index 0000000..1524851
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_05.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@6> |x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|3|,|1|-|1|6| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_06.dump b/src/testdir/dumps/Test_prop_before_tab_06.dump
new file mode 100644
index 0000000..54a06cd
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_06.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7>x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|3|,|2|-|1|7| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_07.dump b/src/testdir/dumps/Test_prop_before_tab_07.dump
new file mode 100644
index 0000000..3b07ac6
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_07.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@5> |x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|4|,|1|-|1|6| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_08.dump b/src/testdir/dumps/Test_prop_before_tab_08.dump
new file mode 100644
index 0000000..07eb40b
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_08.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6>x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|4|,|2|-|1|7| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_09.dump b/src/testdir/dumps/Test_prop_before_tab_09.dump
new file mode 100644
index 0000000..ed30b9e
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_09.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C>x+0&#ffffff0| @62
+@8|x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|5|,|2|-|1|2| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_before_tab_10.dump b/src/testdir/dumps/Test_prop_before_tab_10.dump
new file mode 100644
index 0000000..9957336
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_before_tab_10.dump
@@ -0,0 +1,8 @@
+|1+0&#ffff4012|2|3| +0&#ffffff0@4|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7| +0&#ffffff0|x| @65
+|1+0&#ffff4012|2|3|4|5|6|7|8| +0&#ffffff0@7|x| @57
+|1+0&#ffff4012|2|3|4|5|6|7|8|9| +0&#ffffff0@6|x| @57
+@8|A+0&#ffff4012|B|C|x+0&#ffffff0| @62
+@8>x|A+0&#ffff4012|B|C| +0&#ffffff0@62
+|~+0#4040ff13&| @73
+| +0#0000000&@56|6|,|2|-|9| @8|A|l@1| 
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index fdee30f..caf933d 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -974,10 +974,12 @@
   call assert_equal(1489, line2byte(400))
   bwipe!
 
+call ch_logfile('logfile', 'w')
   " Add many lines so that the data block is split.
   " With and without props should give the same result.
   call Run_test_with_line2byte(0)
   call Run_test_with_line2byte(1)
+call ch_logfile('', 'w')
 
   call prop_type_delete('comment')
 endfunc
@@ -1893,6 +1895,46 @@
   call delete('XscriptPropAfterTab')
 endfunc
 
+func Test_prop_before_tab()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, ["\tx"]->repeat(6))
+      call prop_type_add('test', #{highlight: 'Search'})
+      call prop_add(1, 1, #{type: 'test', text: '123'})
+      call prop_add(2, 1, #{type: 'test', text: '1234567'})
+      call prop_add(3, 1, #{type: 'test', text: '12345678'})
+      call prop_add(4, 1, #{type: 'test', text: '123456789'})
+      call prop_add(5, 2, #{type: 'test', text: 'ABC'})
+      call prop_add(6, 3, #{type: 'test', text: 'ABC'})
+      normal gg0
+  END
+  call writefile(lines, 'XscriptPropBeforeTab')
+  let buf = RunVimInTerminal('-S XscriptPropBeforeTab', #{rows: 8})
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_01', {})
+  call term_sendkeys(buf, "$")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_02', {})
+  call term_sendkeys(buf, "j0")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_03', {})
+  call term_sendkeys(buf, "$")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_04', {})
+  call term_sendkeys(buf, "j0")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_05', {})
+  call term_sendkeys(buf, "$")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_06', {})
+  call term_sendkeys(buf, "j0")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_07', {})
+  call term_sendkeys(buf, "$")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_08', {})
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_09', {})
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_prop_before_tab_10', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptPropBeforeTab')
+endfunc
+
 func Test_prop_after_linebreak()
   CheckRunVimInTerminal