annotate src/testdir/test_listchars.vim @ 24198:c784e176334c v8.2.2640

patch 8.2.2640: screenstring() returns non-existing composing characters Commit: https://github.com/vim/vim/commit/f1387285e2ebe5cb3688d729fc6fd01a169a76c1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 22 17:11:15 2021 +0100 patch 8.2.2640: screenstring() returns non-existing composing characters Problem: screenstring() returns non-existing composing characters. Solution: Only use composing characters if there is a base character.
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Mar 2021 17:15:04 +0100
parents 4d88e660ce32
children ac54d215fbec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'listchars' display with 'list' and :list
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 source view_util.vim
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_listchars()
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 enew!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set ff=unix
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set list
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set listchars+=tab:>-,space:.,trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call append(0, [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ ' aa ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ ' bb ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ ' cccc ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ 'dd ee ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ ' '
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ ])
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let expected = [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ '>-------aa>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ '..bb>---<<$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ '...cccc><$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ 'dd........ee<<>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ '<$'
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ ]
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redraw!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 for i in range(1, 5)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call cursor(i, 1)
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17742
diff changeset
28 call assert_equal([expected[i - 1]], ScreenLines(i, '$'->virtcol()))
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfor
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set listchars-=trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let expected = [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ '>-------aa>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ '..bb>---..$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ '...cccc>.$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ 'dd........ee..>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ '.$'
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ ]
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 redraw!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 for i in range(1, 5)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call cursor(i, 1)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfor
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
15502
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
45 " tab with 3rd character.
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
46 set listchars-=tab:>-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
47 set listchars+=tab:<=>,trail:-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
48 let expected = [
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
49 \ '<======>aa<====>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
50 \ '..bb<==>--$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
51 \ '...cccc>-$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
52 \ 'dd........ee--<>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
53 \ '-$'
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
54 \ ]
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
55 redraw!
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
56 for i in range(1, 5)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
57 call cursor(i, 1)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
58 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
59 endfor
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
60
17742
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
61 " tab with 3rd character and linebreak set
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
62 set listchars-=tab:<=>
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
63 set listchars+=tab:<·>
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
64 set linebreak
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
65 let expected = [
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
66 \ '<······>aa<····>$',
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
67 \ '..bb<··>--$',
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
68 \ '...cccc>-$',
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
69 \ 'dd........ee--<>$',
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
70 \ '-$'
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
71 \ ]
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
72 redraw!
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
73 for i in range(1, 5)
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
74 call cursor(i, 1)
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
75 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
76 endfor
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
77 set nolinebreak
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
78 set listchars-=tab:<·>
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
79 set listchars+=tab:<=>
a51ccadd0dca patch 8.1.1868: multi-byte chars in 'listchars' fail with 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 16592
diff changeset
80
15502
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
81 set listchars-=trail:-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
82 let expected = [
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
83 \ '<======>aa<====>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
84 \ '..bb<==>..$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
85 \ '...cccc>.$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
86 \ 'dd........ee..<>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
87 \ '.$'
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
88 \ ]
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
89 redraw!
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
90 for i in range(1, 5)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
91 call cursor(i, 1)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
92 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
93 endfor
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
94
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
95 set listchars-=tab:<=>
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
96 set listchars+=tab:>-
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 set listchars+=trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 set nolist
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 normal ggdG
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call append(0, [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 \ ' fff ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 \ ' gg ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 \ ' h ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 \ 'iii ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 \ ])
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 let l = split(execute("%list"), "\n")
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call assert_equal([
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 \ '..fff>--<<$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 \ '>-------gg>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 \ '.....h>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 \ 'iii<<<<><<$', '$'], l)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112
23825
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
113 " Test lead and trail
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
114 normal ggdG
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
115 set listchars&
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
116 set listchars+=lead:>,trail:<,space:x
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
117 set list
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
118
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
119 call append(0, [
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
120 \ ' ffff ',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
121 \ ' gg',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
122 \ 'h ',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
123 \ ' ',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
124 \ ' 0 0 ',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
125 \ ])
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
126
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
127 let expected = [
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
128 \ '>>>>ffff<<<<$',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
129 \ '>>>>>>>>>>gg$',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
130 \ 'h<<<<<<<<<<<$',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
131 \ '<<<<<<<<<<<<$',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
132 \ '>>>>0xx0<<<<$',
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
133 \ '$'
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
134 \ ]
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
135 redraw!
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
136 for i in range(1, 5)
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
137 call cursor(i, 1)
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
138 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
139 endfor
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
140
0bd44e94dd14 patch 8.2.2454: leading space can not be made visible
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
141 call assert_equal(expected, split(execute("%list"), "\n"))
15715
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
142
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
143 " test nbsp
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
144 normal ggdG
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
145 set listchars=nbsp:X,trail:Y
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
146 set list
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
147 " Non-breaking space
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
148 let nbsp = nr2char(0xa0)
24198
c784e176334c patch 8.2.2640: screenstring() returns non-existing composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23956
diff changeset
149 call append(0, [ ">" .. nbsp .. "<" ])
15715
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
150
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
151 let expected = '>X< '
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
152
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
153 redraw!
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
154 call cursor(1, 1)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
155 call assert_equal([expected], ScreenLines(1, virtcol('$')))
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
156
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
157 set listchars=nbsp:X
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
158 redraw!
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
159 call cursor(1, 1)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
160 call assert_equal([expected], ScreenLines(1, virtcol('$')))
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
161
16592
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
162 " test extends
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
163 normal ggdG
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
164 set listchars=extends:Z
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
165 set nowrap
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
166 set nolist
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
167 call append(0, [ repeat('A', &columns + 1) ])
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
168
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
169 let expected = repeat('A', &columns)
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
170
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
171 redraw!
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
172 call cursor(1, 1)
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
173 call assert_equal([expected], ScreenLines(1, &columns))
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
174
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
175 set list
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
176 let expected = expected[:-2] . 'Z'
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
177 redraw!
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
178 call cursor(1, 1)
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
179 call assert_equal([expected], ScreenLines(1, &columns))
80bb4ce2a281 patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off
Bram Moolenaar <Bram@vim.org>
parents: 16211
diff changeset
180
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 enew!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 set listchars& ff&
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 endfunc
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
184
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
185 " Test that unicode listchars characters get properly inserted
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
186 func Test_listchars_unicode()
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
187 enew!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
188 let oldencoding=&encoding
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
189 set encoding=utf-8
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
190 set ff=unix
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
191
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
192 set listchars=eol:⇔,space:␣,nbsp:≠,tab:←↔→
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
193 set list
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
194
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
195 let nbsp = nr2char(0xa0)
24198
c784e176334c patch 8.2.2640: screenstring() returns non-existing composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23956
diff changeset
196 call append(0, ["a\tb c" .. nbsp .. "d"])
c784e176334c patch 8.2.2640: screenstring() returns non-existing composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23956
diff changeset
197 let expected = ['a←↔↔↔↔↔→b␣c≠d⇔']
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
198 redraw!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
199 call cursor(1, 1)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
200 call assert_equal(expected, ScreenLines(1, virtcol('$')))
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
201 let &encoding=oldencoding
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
202 enew!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
203 set listchars& ff&
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
204 endfunction
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
205
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
206 " Tests that space characters following composing character won't get replaced
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
207 " by listchars.
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
208 func Test_listchars_composing()
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
209 enew!
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
210 let oldencoding=&encoding
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
211 set encoding=utf-8
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
212 set ff=unix
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
213 set list
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
214
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
215 set listchars=eol:$,space:_,nbsp:=
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
216
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
217 let nbsp1 = nr2char(0xa0)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
218 let nbsp2 = nr2char(0x202f)
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
219 call append(0, [
24198
c784e176334c patch 8.2.2640: screenstring() returns non-existing composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23956
diff changeset
220 \ " \u3099\t \u309A" .. nbsp1 .. nbsp1 .. "\u0302" .. nbsp2 .. nbsp2 .. "\u0302",
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
221 \ ])
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
222 let expected = [
24198
c784e176334c patch 8.2.2640: screenstring() returns non-existing composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23956
diff changeset
223 \ "_ \u3099^I \u309A=" .. nbsp1 .. "\u0302=" .. nbsp2 .. "\u0302$"
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
224 \ ]
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
225 redraw!
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
226 call cursor(1, 1)
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
227 call assert_equal(expected, ScreenLines(1, virtcol('$')))
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
228 let &encoding=oldencoding
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
229 enew!
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
230 set listchars& ff&
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
231 endfunction
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
232
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
233 " Check for the value of the 'listchars' option
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
234 func s:CheckListCharsValue(expected)
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
235 call assert_equal(a:expected, &listchars)
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
236 call assert_equal(a:expected, getwinvar(0, '&listchars'))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
237 endfunc
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
238
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
239 " Test for using a window local value for 'listchars'
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
240 func Test_listchars_window_local()
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
241 %bw!
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
242 set list listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
243 new
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
244 " set a local value for 'listchars'
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
245 setlocal listchars=tab:+-,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
246 call s:CheckListCharsValue('tab:+-,eol:#')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
247 " When local value is reset, global value should be used
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
248 setlocal listchars=
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
249 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
250 " Use 'setlocal <' to copy global value
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
251 setlocal listchars=space:.,extends:>
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
252 setlocal listchars<
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
253 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
254 " Use 'set <' to copy global value
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
255 setlocal listchars=space:.,extends:>
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
256 set listchars<
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
257 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
258 " Changing global setting should not change the local setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
259 setlocal listchars=space:.,extends:>
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
260 setglobal listchars=tab:+-,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
261 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
262 " when split opening a new window, local value should be copied
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
263 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
264 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
265 " clearing local value in one window should not change the other window
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
266 set listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
267 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
268 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
269 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
270
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
271 " use different values for 'listchars' items in two different windows
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
272 call setline(1, ["\t one two "])
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
273 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
274 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
275 setlocal listchars=tab:[.],lead:#,space:_,trail:.,eol:&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
276 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
277 set listchars=tab:+-+,lead:^,space:>,trail:<,eol:%
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
278 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
279 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
280 call assert_equal(['[......]##one__two..&'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
281 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
282 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
283 " changing the global setting should not change the local value
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
284 setglobal listchars=tab:[.],lead:#,space:_,trail:.,eol:&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
285 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
286 set listchars<
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
287 call assert_equal(['[......]##one__two..&'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
288
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
289 " Using setglobal in a window with local setting should not affect the
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
290 " window. But should impact other windows using the global setting.
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
291 enew! | only
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
292 call setline(1, ["\t one two "])
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
293 set listchars=tab:[.],lead:#,space:_,trail:.,eol:&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
294 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
295 setlocal listchars=tab:+-+,lead:^,space:>,trail:<,eol:%
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
296 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
297 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
298 setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
299 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
300 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
301 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
302 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
303 call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
304
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
305 " Setting the global setting to the default value should not impact a window
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
306 " using a local setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
307 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
308 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
309 setglobal listchars&vim
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
310 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
311 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
312 call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
313
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
314 " Setting the local setting to the default value should not impact a window
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
315 " using a global setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
316 set listchars=tab:{.},lead:-,space:=,trail:#,eol:$
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
317 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
318 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
319 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
320 setlocal listchars&vim
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
321 call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
322 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
323 call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
324
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
325 " Using set in a window with a local setting should change it to use the
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
326 " global setting and also impact other windows using the global setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
327 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
328 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
329 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
330 set listchars=tab:+-+,lead:^,space:>,trail:<,eol:%
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
331 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
332 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
333 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
334
23956
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
335 " Setting invalid value for a local setting should not impact the local and
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
336 " global settings
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
337 split
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
338 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
339 let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
340 call assert_fails(cmd, 'E474:')
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
341 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
342 close
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
343 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
344
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
345 " Setting invalid value for a global setting should not impact the local and
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
346 " global settings
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
347 split
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
348 setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
349 let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
350 call assert_fails(cmd, 'E474:')
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
351 call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
352 close
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
353 call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
354
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
355 %bw!
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
356 set list& listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
357 endfunc
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
358
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
359 " vim: shiftwidth=2 sts=2 expandtab