patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left

Problem:    With 'nowrap' virtual text "after" does not scroll left.
Solution:   Skip part of the virtual text that is left of the window.
            (closes #11320)  Fix going beyond the last column of the window.
diff --git a/src/testdir/dumps/Test_text_after_nowrap_1.dump b/src/testdir/dumps/Test_text_after_nowrap_1.dump
index d8711b8..0781e6c 100644
--- a/src/testdir/dumps/Test_text_after_nowrap_1.dump
+++ b/src/testdir/dumps/Test_text_after_nowrap_1.dump
@@ -1,8 +1,8 @@
-|f+0&#ffffff0|i|r|s|t| |l|i|n|e| @1|a+0&#ffd7ff255|f|t|e|r| |t|h|e| |t|e|x|t| |a|f|t|e|r| |t|h|e| |t|e|x|t| |a|f|t|e|r| |t|h|e| |t|e|x|t| |a|f|t
-|s+0&#ffffff0|e|c|o|n|d| >l|i|n|e| |s|e|c|o|n|d| |l|i|n|e| |s|e|c|o|n|d| |l|i|n|e| |s|e|c|o|n|d| |l|i|n|e| |s|e|c|o|n|d| |l|i|n|e| 
+|f+0&#ffffff0|i|r|s|t| |l|i|n|e| @1|r+0&#ffd7ff255|i|g|h|t| |a|f|t|e|r| |t|h|e| |t|e|x|t| |r|i|g|h|t| |a|f|t|e|r| |t|h|e| |t|e|x|t| |r|i|g|h|t| 
+|0+0&#ffffff0| >1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| |2|1| |2@1| |2
 |t|h|i|r|d| @54
 |f|o|u|r|t|h| @53
 |~+0#4040ff13&| @58
 |~| @58
 |~| @58
-| +0#0000000&@41|2|,|8| @10|A|l@1| 
+| +0#0000000&@41|2|,|3| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_text_after_nowrap_2.dump b/src/testdir/dumps/Test_text_after_nowrap_2.dump
new file mode 100644
index 0000000..28a45f3
--- /dev/null
+++ b/src/testdir/dumps/Test_text_after_nowrap_2.dump
@@ -0,0 +1,8 @@
+| +0&#ffd7ff255|r|i|g|h|t| |a|f|t|e|r| |t|h|e| | +0&#ffffff0@2|i+0&#ffd7ff255|n| |t|h|e| |m|i|d@1|l|e| |i|n| |t|h|e| |m|i|d@1|l|e| |i|n| |t|h|e| |m|i|d@1|l
+|2+0&#ffffff0|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| |3|0| >3|1| |3|2| |3@1| |3|4| |3|5| |3|6| |3|7| |3|8| |3|9| |4|0| 
+@60
+@60
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|8|4| @9|A|l@1| 
diff --git a/src/testdir/dumps/Test_text_after_nowrap_3.dump b/src/testdir/dumps/Test_text_after_nowrap_3.dump
new file mode 100644
index 0000000..0a7cb3b
--- /dev/null
+++ b/src/testdir/dumps/Test_text_after_nowrap_3.dump
@@ -0,0 +1,8 @@
+|h+0&#ffd7ff255|e| |m|i|d@1|l|e| | +0&#ffffff0|t+0&#ffd7ff255|h|e| |l|a|s|t| |o|n|e| |t|h|e| |l|a|s|t| |o|n|e| |t|h|e| |l|a|s|t| |o|n|e| | +0&#ffffff0@9
+|4|3| |4@1| |4|5| |4|6| |4|7| |4|8| |4|9| |5|0| |5|1| |5|2| >5|3| |5|4| |5@1| |5|6| |5|7| |5|8| |5|9| |6|0| |6|1| |6|2| 
+@60
+@60
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|1|5|0| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_text_after_nowrap_4.dump b/src/testdir/dumps/Test_text_after_nowrap_4.dump
new file mode 100644
index 0000000..ffe1c76
--- /dev/null
+++ b/src/testdir/dumps/Test_text_after_nowrap_4.dump
@@ -0,0 +1,8 @@
+| +0&#ffffff0@59
+|9| |7|0| |7|1| |7|2| |7|3| |7|4| |7|5| |7|6| |7@1| |7|8| |7>9| @28
+@60
+@60
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|2|,|2@1|9| @8|A|l@1| 
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 624f23f..b4178e5 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -3214,30 +3214,44 @@
 func Test_text_after_nowrap()
   CheckRunVimInTerminal
 
-  " FIXME: the second property causes a hang
   let lines =<< trim END
       vim9script
-      setline(1, ['first line', 'second line '->repeat(50), 'third', 'fourth'])
+      setline(1, ['first line', range(80)->join(' '), 'third', 'fourth'])
       set nowrap
       prop_type_add('theprop', {highlight: 'DiffChange'})
       prop_add(1, 0, {
           type: 'theprop',
-          text: 'after the text '->repeat(5),
+          text: 'right after the text '->repeat(3),
           text_align: 'after',
           text_padding_left: 2,
       })
-      #prop_add(1, 0, {
-      #    type: 'theprop',
-      #    text: 'after the text '->repeat(5),
-      #    text_align: 'after',
-      #    text_padding_left: 2,
-      #})
+      prop_add(1, 0, {
+          type: 'theprop',
+          text: 'in the middle '->repeat(4),
+          text_align: 'after',
+          text_padding_left: 3,
+      })
+      prop_add(1, 0, {
+          type: 'theprop',
+          text: 'the last one '->repeat(3),
+          text_align: 'after',
+          text_padding_left: 1,
+      })
       normal 2Gw
   END
   call writefile(lines, 'XTextAfterNowrap', 'D')
   let buf = RunVimInTerminal('-S XTextAfterNowrap', #{rows: 8, cols: 60})
   call VerifyScreenDump(buf, 'Test_text_after_nowrap_1', {})
 
+  call term_sendkeys(buf, "30w")
+  call VerifyScreenDump(buf, 'Test_text_after_nowrap_2', {})
+
+  call term_sendkeys(buf, "22w")
+  call VerifyScreenDump(buf, 'Test_text_after_nowrap_3', {})
+
+  call term_sendkeys(buf, "$")
+  call VerifyScreenDump(buf, 'Test_text_after_nowrap_4', {})
+
   call StopVimInTerminal(buf)
 endfunc