Mercurial > vim
annotate src/testdir/test_matchadd_conceal_utf8.vim @ 15097:1946487c74ba v8.1.0559
patch 8.1.0559: command line completion not sufficiently tested
commit https://github.com/vim/vim/commit/b513d3079bbe3f59a1f1a3d6931939a76cd7e54a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 2 14:55:08 2018 +0100
patch 8.1.0559: command line completion not sufficiently tested
Problem: Command line completion not sufficiently tested.
Solution: Add more tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/3622)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Dec 2018 15:00:05 +0100 |
parents | 81ba6e4eb72b |
children | 63b02fcf1361 |
rev | line source |
---|---|
8907
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for matchadd() and conceal feature using utf-8. |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 if !has('conceal') || !has('multi_byte') |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 finish |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 endif |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 if !has('gui_running') && has('unix') |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 set term=ansi |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endif |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 function! s:screenline(lnum) abort |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 let line = [] |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 for c in range(1, winwidth(0)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call add(line, nr2char(screenchar(a:lnum, c))) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfor |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 return s:trim(join(line, '')) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunction |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 function! s:trim(str) abort |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$') |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 endfunction |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 function! Test_match_using_multibyte_conceal_char() |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 new |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 setlocal concealcursor=n conceallevel=1 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 1put='# This is a Test' |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " 1234567890123456 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 let expect = '#ˑThisˑisˑaˑTest' |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call cursor(1, 1) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"}) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 redraw! |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 let lnum = 2 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_equal(expect, s:screenline(lnum)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 quit! |
5deb9e8f4292
commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 endfunction |