]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0143: cursor positioned after virtual text in empty line v9.0.0143
authorBram Moolenaar <Bram@vim.org>
Fri, 5 Aug 2022 12:07:23 +0000 (13:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 5 Aug 2022 12:07:23 +0000 (13:07 +0100)
Problem:    Cursor positioned after virtual text in empty line.
Solution:   Keep cursor in the first column. (closes #10786)

src/charset.c
src/testdir/dumps/Test_prop_inserts_text_1.dump
src/testdir/dumps/Test_prop_inserts_text_2.dump
src/testdir/dumps/Test_prop_inserts_text_3.dump [new file with mode: 0644]
src/testdir/dumps/Test_prop_inserts_text_4.dump [new file with mode: 0644]
src/testdir/test_textprop.vim
src/version.c

index c32044adb5ef881cb265ade4288bc943f2d192a2..f7ce33505d9e17af44cc7d639665693be3040868 100644 (file)
@@ -1127,7 +1127,7 @@ win_lbr_chartabsize(
     size = win_chartabsize(wp, s, vcol);
 
 # ifdef FEAT_PROP_POPUP
-    if (cts->cts_has_prop_with_text)
+    if (cts->cts_has_prop_with_text && *line != NUL)
     {
        int         i;
        int         col = (int)(s - line);
index 2248076b668689f50c425eed224880a5352e43f4..95e2d7a70fbf9cb17a4d3c1ef55aba452506e666 100644 (file)
@@ -1,6 +1,6 @@
 |i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| |s|o
 |m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n>g| @27
 |p|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @40
+|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@49
 |~+0#4040ff13&| @58
-|~| @58
 | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1| 
index 6103c75e4da4c901ae036fc68e3422b363c76c67..d61bf1b5b9037e44d32e2550bf91440f3892f5ff 100644 (file)
@@ -1,6 +1,6 @@
 | +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| 
 | +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n>g| @23
 | +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
+| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
 |~+0#4040ff13&| @58
-|~| @58
 | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_inserts_text_3.dump b/src/testdir/dumps/Test_prop_inserts_text_3.dump
new file mode 100644 (file)
index 0000000..c7685d9
--- /dev/null
@@ -0,0 +1,6 @@
+| +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| 
+| +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n|g| @23
+| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s>t| @38
+| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+|~+0#4040ff13&| @58
+| +0#0000000&@41|2|,|7|-|1|9| @7|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_inserts_text_4.dump b/src/testdir/dumps/Test_prop_inserts_text_4.dump
new file mode 100644 (file)
index 0000000..6f94b85
--- /dev/null
@@ -0,0 +1,6 @@
+| +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| 
+| +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n|g| @23
+| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
+| +0#0000e05#a8a8a8255@1>e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+|~+0#4040ff13&| @58
+| +0#0000000&@41|3|,|0|-|1| @8|A|l@1| 
index c6f6739d9d75509dc66a719c67d2bc62e4581bd9..03af37ac3ca6b88d6e0ae1d141d43908d08a3df5 100644 (file)
@@ -2221,6 +2221,9 @@ func Test_prop_inserts_text()
       call setline(2, 'prepost')
       call prop_type_add('multibyte', #{highlight: 'Visual'})
       call prop_add(2, 4, #{type: 'multibyte', text: 'söme和平téxt'})
+
+      call setline(3, '')
+      call prop_add(3, 1, #{type: 'someprop', text: 'empty line'})
   END
   call writefile(lines, 'XscriptPropsWithText')
   let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 6, cols: 60})
@@ -2229,6 +2232,12 @@ func Test_prop_inserts_text()
   call term_sendkeys(buf, ":set signcolumn=yes\<CR>")
   call VerifyScreenDump(buf, 'Test_prop_inserts_text_2', {})
 
+  call term_sendkeys(buf, "2G$")
+  call VerifyScreenDump(buf, 'Test_prop_inserts_text_3', {})
+
+  call term_sendkeys(buf, "3G")
+  call VerifyScreenDump(buf, 'Test_prop_inserts_text_4', {})
+
   call StopVimInTerminal(buf)
   call delete('XscriptPropsWithText')
 endfunc
index c0b2aa07d20336a8ce63576e4cb2e165dd19b6ff..e13e92cec68c07e1a88d0e7c74a8141dacd14648 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    143,
 /**/
     142,
 /**/