annotate src/testdir/test_listchars.vim @ 23956:4d88e660ce32 v8.2.2520

patch 8.2.2520: missing tests for 'listchars' Commit: https://github.com/vim/vim/commit/04ea7e9049706788179945e2a91922c0b7cb9ed0 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 16 21:14:33 2021 +0100 patch 8.2.2520: missing tests for 'listchars' Problem: Missing tests for 'listchars'. Solution: Add a few more checks. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7854)
author Bram Moolenaar <Bram@vim.org>
date Tue, 16 Feb 2021 21:15:04 +0100
parents 44be09b25619
children c784e176334c
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)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
149 call append(0, [ ">".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
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)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
196 call append(0, [
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
197 \ "a\tb c".nbsp."d"
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
198 \ ])
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
199 let expected = [
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
200 \ 'a←↔↔↔↔↔→b␣c≠d⇔'
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
201 \ ]
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
202 redraw!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
203 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
204 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
205 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
206 enew!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
207 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
208 endfunction
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
209
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
210 " 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
211 " 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
212 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
213 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
214 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
215 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
216 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
217 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
218
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
219 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
220
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
221 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
222 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
223 call append(0, [
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
224 \ " \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
225 \ ])
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 let expected = [
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 \ "_ \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
228 \ ]
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
229 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
230 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
231 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
232 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
233 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
234 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
235 endfunction
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
236
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
237 " 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
238 func s:CheckListCharsValue(expected)
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
239 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
240 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
241 endfunc
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
242
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
243 " 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
244 func Test_listchars_window_local()
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
245 %bw!
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
246 set list listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
247 new
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
248 " 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
249 setlocal listchars=tab:+-,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
250 call s:CheckListCharsValue('tab:+-,eol:#')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
251 " 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
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 'setlocal <' 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 setlocal 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 " 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
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 set listchars<
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
261 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
262 " 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
263 setlocal listchars=space:.,extends:>
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
264 setglobal listchars=tab:+-,eol:#
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
265 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
266 " 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
267 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
268 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
269 " 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
270 set listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
271 call s:CheckListCharsValue('eol:$')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
272 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
273 call s:CheckListCharsValue('space:.,extends:>')
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
274
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
275 " 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
276 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
277 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
278 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
279 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
280 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
281 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
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 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
284 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
285 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
286 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
287 " 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
288 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
289 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
290 set listchars<
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
291 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
292
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
293 " 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
294 " 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
295 enew! | only
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
296 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
297 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
298 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
299 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
300 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
301 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
302 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
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 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
305 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
306 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
307 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
308
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
309 " 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
310 " using a local setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
311 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
312 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
313 setglobal listchars&vim
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
314 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
315 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
316 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
317
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
318 " 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
319 " using a global setting
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
320 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
321 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
322 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
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 setlocal listchars&vim
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
325 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
326 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
327 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
328
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
329 " 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
330 " 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
331 split
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
332 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
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 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
335 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
336 close
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
337 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
338
23956
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
339 " 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
340 " global settings
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
341 split
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
342 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
343 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
344 call assert_fails(cmd, 'E474:')
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
345 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
346 close
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
347 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
348
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
349 " 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
350 " global settings
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
351 split
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
352 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
353 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
354 call assert_fails(cmd, 'E474:')
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
355 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
356 close
4d88e660ce32 patch 8.2.2520: missing tests for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
357 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
358
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
359 %bw!
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
360 set list& listchars&
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
361 endfunc
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23825
diff changeset
362
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
363 " vim: shiftwidth=2 sts=2 expandtab