]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0334: No test for highlight behavior with 'ambiwidth' v9.1.0334
authorzeertzjq <zeertzjq@outlook.com>
Mon, 15 Apr 2024 17:14:38 +0000 (19:14 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 15 Apr 2024 17:14:38 +0000 (19:14 +0200)
Problem:  No test for highlight behavior with 'ambiwidth'.
Solution: Add a screendump test for 'ambiwidth' with 'cursorline'.
          (zeertzjq)

closes: #14554

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/dumps/Test_ambiwidth_hl_dump_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_ambiwidth_hl_dump_2.dump [new file with mode: 0644]
src/testdir/test_regexp_utf8.vim
src/testdir/test_utf8.vim
src/version.c

diff --git a/src/testdir/dumps/Test_ambiwidth_hl_dump_1.dump b/src/testdir/dumps/Test_ambiwidth_hl_dump_1.dump
new file mode 100644 (file)
index 0000000..383a6f4
--- /dev/null
@@ -0,0 +1,6 @@
+>℃+8&#ffffff0@49
+@10|$+8#4040ff13&| +8#0000000&@38
+|℃+0&&@49
+@10|$+0#4040ff13&| +0#0000000&@38
+|~+0#4040ff13&| @48
+| +0#0000000&@31|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_ambiwidth_hl_dump_2.dump b/src/testdir/dumps/Test_ambiwidth_hl_dump_2.dump
new file mode 100644 (file)
index 0000000..81aeb7b
--- /dev/null
@@ -0,0 +1,6 @@
+>℃+8&#ffffff0| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| 
+|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| 
+|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |$+8#4040ff13&| +8#0000000&@28
+|℃+0&&| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| 
+|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| @1|@+0#4040ff13&@2
+| +0#0000000&@31|1|,|1| @10|T|o|p| 
index 6669dee57e4cc7af650ed2d5bb4ba297c6da5d11..bc705441e7a1a49eb034e7f14262ddacee144048 100644 (file)
@@ -342,7 +342,7 @@ func Test_multibyte_chars()
 endfunc
 
 " check that 'ambiwidth' does not change the meaning of \p
-func Test_ambiwidth()
+func Test_regexp_ambiwidth()
   set regexpengine=1 ambiwidth=single
   call assert_equal(0, match("\u00EC", '\p'))
   set regexpengine=1 ambiwidth=double
index deb96ea4b0255a122e16716a64a004267d213f83..df0abd354c80f613ba6731f43fa0044f9589415d 100644 (file)
@@ -62,6 +62,9 @@ func Test_customlist_completion()
   call assert_equal('"Test3 N', getreg(':'))
 
   call garbagecollect(1)
+  delcommand Test1
+  delcommand Test2
+  delcommand Test3
 endfunc
 
 " Yank one 3 byte character and check the mark columns.
@@ -297,6 +300,40 @@ func Test_setcellwidths_dump()
   call StopVimInTerminal(buf)
 endfunc
 
+" For some reason this test causes Test_customlist_completion() to fail on CI,
+" so run it as the last test.
+func Test_zz_ambiwidth_hl_dump()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      call setline(1, [repeat("\u2103", 60), repeat("\u2103", 60)])
+      set ambiwidth=single cursorline list display=lastline
+  END
+  call writefile(lines, 'XAmbiwidthHl', 'D')
+  let buf = RunVimInTerminal('-S XAmbiwidthHl', {'rows': 6, 'cols': 50})
+  call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
+
+  call term_sendkeys(buf, ":set ambiwidth=double\<CR>")
+  call term_sendkeys(buf, ":echo\<CR>")
+  call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_2', {})
+
+  call term_sendkeys(buf, ":set ambiwidth=single\<CR>")
+  call term_sendkeys(buf, ":echo\<CR>")
+  call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
+
+  if 0 " Enable after #14539 is fixed
+  call term_sendkeys(buf, ":call setcellwidths([[0x2103, 0x2103, 2]])\<CR>")
+  call term_sendkeys(buf, ":echo\<CR>")
+  call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_2', {})
+
+  call term_sendkeys(buf, ":call setcellwidths([[0x2103, 0x2103, 1]])\<CR>")
+  call term_sendkeys(buf, ":echo\<CR>")
+  call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
+  endif
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_print_overlong()
   " Text with more composing characters than MB_MAXBYTES.
   new
index fc10c7c79b25cd1d53a22e40d9b0b37b1d1713ba..7a942c2dc1fe3b32f6e7da3addf5e96161e218a6 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    334,
 /**/
     333,
 /**/