Skip to content

Commit a59e031

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.0334: No test for highlight behavior with 'ambiwidth'
Problem: No test for highlight behavior with 'ambiwidth'. Solution: Add a screendump test for 'ambiwidth' with 'cursorline'. (zeertzjq) closes: #14554 Signed-off-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 29358d2 commit a59e031

5 files changed

Lines changed: 52 additions & 1 deletion

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
>℃+8&#ffffff0@49
2+
@10|$+8#4040ff13&| +8#0000000&@38
3+
|℃+0&&@49
4+
@10|$+0#4040ff13&| +0#0000000&@38
5+
|~+0#4040ff13&| @48
6+
| +0#0000000&@31|1|,|1| @10|A|l@1|
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
>℃+8&#ffffff0| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃|
2+
|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃|
3+
|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |$+8#4040ff13&| +8#0000000&@28
4+
|℃+0&&| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃|
5+
|℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| |℃| @1|@+0#4040ff13&@2
6+
| +0#0000000&@31|1|,|1| @10|T|o|p|

src/testdir/test_regexp_utf8.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func Test_multibyte_chars()
342342
endfunc
343343

344344
" check that 'ambiwidth' does not change the meaning of \p
345-
func Test_ambiwidth()
345+
func Test_regexp_ambiwidth()
346346
set regexpengine=1 ambiwidth=single
347347
call assert_equal(0, match("\u00EC", '\p'))
348348
set regexpengine=1 ambiwidth=double

src/testdir/test_utf8.vim

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ func Test_customlist_completion()
6262
call assert_equal('"Test3 N', getreg(':'))
6363

6464
call garbagecollect(1)
65+
delcommand Test1
66+
delcommand Test2
67+
delcommand Test3
6568
endfunc
6669

6770
" Yank one 3 byte character and check the mark columns.
@@ -297,6 +300,40 @@ func Test_setcellwidths_dump()
297300
call StopVimInTerminal(buf)
298301
endfunc
299302

303+
" For some reason this test causes Test_customlist_completion() to fail on CI,
304+
" so run it as the last test.
305+
func Test_zz_ambiwidth_hl_dump()
306+
CheckRunVimInTerminal
307+
308+
let lines =<< trim END
309+
call setline(1, [repeat("\u2103", 60), repeat("\u2103", 60)])
310+
set ambiwidth=single cursorline list display=lastline
311+
END
312+
call writefile(lines, 'XAmbiwidthHl', 'D')
313+
let buf = RunVimInTerminal('-S XAmbiwidthHl', {'rows': 6, 'cols': 50})
314+
call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
315+
316+
call term_sendkeys(buf, ":set ambiwidth=double\<CR>")
317+
call term_sendkeys(buf, ":echo\<CR>")
318+
call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_2', {})
319+
320+
call term_sendkeys(buf, ":set ambiwidth=single\<CR>")
321+
call term_sendkeys(buf, ":echo\<CR>")
322+
call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
323+
324+
if 0 " Enable after #14539 is fixed
325+
call term_sendkeys(buf, ":call setcellwidths([[0x2103, 0x2103, 2]])\<CR>")
326+
call term_sendkeys(buf, ":echo\<CR>")
327+
call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_2', {})
328+
329+
call term_sendkeys(buf, ":call setcellwidths([[0x2103, 0x2103, 1]])\<CR>")
330+
call term_sendkeys(buf, ":echo\<CR>")
331+
call VerifyScreenDump(buf, 'Test_ambiwidth_hl_dump_1', {})
332+
endif
333+
334+
call StopVimInTerminal(buf)
335+
endfunc
336+
300337
func Test_print_overlong()
301338
" Text with more composing characters than MB_MAXBYTES.
302339
new

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
334,
707709
/**/
708710
333,
709711
/**/

0 commit comments

Comments
 (0)