]> granicus.if.org Git - vim/commitdiff
patch 9.0.1327: cursor in wrong position below line with virtual text below v9.0.1327
authorBram Moolenaar <Bram@vim.org>
Sun, 19 Feb 2023 18:36:41 +0000 (18:36 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 19 Feb 2023 18:36:41 +0000 (18:36 +0000)
Problem:    Cursor in wrong position below line with virtual text below ending
            in multi-byte character.
Solution:   When checking for last character take care of multi-byte
            character.

src/charset.c
src/testdir/dumps/Test_prop_multibyte_below_1.dump [new file with mode: 0644]
src/testdir/test_textprop.vim
src/version.c

index a8c20f9eb385d90ef7d9646a6073b59c7042daa7..d8feb4eadc958c3f0a99e37d333d6793a27d9316 100644 (file)
@@ -1196,7 +1196,7 @@ win_lbr_chartabsize(
                       || (tp->tp_col == MAXCOL
                           && ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE)
                                ? col == 0
-                               : (s[0] == NUL || s[1] == NUL)
+                               : (s[0] == NUL || s[charlen] == NUL)
                                                  && cts->cts_with_trailing)))
                    && -tp->tp_id - 1 < gap->ga_len)
            {
diff --git a/src/testdir/dumps/Test_prop_multibyte_below_1.dump b/src/testdir/dumps/Test_prop_multibyte_below_1.dump
new file mode 100644 (file)
index 0000000..838611b
--- /dev/null
@@ -0,0 +1,10 @@
+| +0#af5f00255#ffffff0@1|1| |©+0#0000000&| @54
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|2| |©+0#0000000&| @54
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@1|3| >©+0#0000000&| @54
+| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|3|,|1| @10|A|l@1| 
index 3bd08fe4d71da1afc5c47611b1b3861ed131ae74..cd141eb6a08f41c84a4d6df4082f077dd84a9806 100644 (file)
@@ -2817,6 +2817,27 @@ func Test_prop_with_text_above_below_empty()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_prop_with_multibyte_below()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      setlocal number
+      call setline(1, ['©', '©', '©'])
+
+      let vt = 'test'
+      call prop_type_add(vt, {'highlight': 'ToDo'})
+      for ln in range(1, line('$'))
+        call prop_add(ln, 0, {'type': vt, 'text': '+++', 'text_align': 'below'})
+      endfor
+      normal G
+  END
+  call writefile(lines, 'XscriptPropMultibyteBelow', 'D')
+  let buf = RunVimInTerminal('-S XscriptPropMultibyteBelow', #{rows: 10, cols: 60})
+  call VerifyScreenDump(buf, 'Test_prop_multibyte_below_1', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_prop_with_text_above_empty()
   CheckRunVimInTerminal
 
index 53452bfbe76d4bb8b8e1f40c13012b9aec464cf7..f8b75d74d88cb19519d6404e74a1bc52d1aa438c 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1327,
 /**/
     1326,
 /**/