comparison src/testdir/test_cursorline.vim @ 18068:1101eacc1444 v8.1.2029

patch 8.1.2029: cannot control 'cursorline' highlighting well Commit: https://github.com/vim/vim/commit/017ba07fa2cdc578245618717229444fd50c470d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 14 21:01:23 2019 +0200 patch 8.1.2029: cannot control 'cursorline' highlighting well Problem: Cannot control 'cursorline' highlighting well. Solution: Add "screenline". (Christian Brabandt, closes https://github.com/vim/vim/issues/4933)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Sep 2019 21:15:04 +0200
parents 6650e3dff8d4
children 1f5571e7f012
comparison
equal deleted inserted replaced
18067:9e20b59dd8ab 18068:1101eacc1444
1 " Test for cursorline and cursorlineopt 1 " Test for cursorline and cursorlineopt
2 " 2
3 source view_util.vim
4 source check.vim 3 source check.vim
4 source screendump.vim
5 5
6 function! s:screen_attr(lnum) abort 6 function! s:screen_attr(lnum) abort
7 return map(range(1, 8), 'screenattr(a:lnum, v:val)') 7 return map(range(1, 8), 'screenattr(a:lnum, v:val)')
8 endfunction 8 endfunction
9 9
104 call s:close_windows() 104 call s:close_windows()
105 finally 105 finally
106 exe 'hi' save_hi 106 exe 'hi' save_hi
107 endtry 107 endtry
108 endfunc 108 endfunc
109
110 func Test_cursorline_screenline()
111 CheckScreendump
112 CheckOption cursorlineopt
113 let filename='Xcursorline'
114 let lines = []
115
116 let file_content =<< trim END
117 1 foooooooo ar eins‍zwei drei vier fünf sechs sieben acht un zehn elf zwöfl dreizehn v ierzehn fünfzehn
118 2 foooooooo bar eins zwei drei vier fünf sechs sieben
119 3 foooooooo bar eins zwei drei vier fünf sechs sieben
120 4 foooooooo bar eins zwei drei vier fünf sechs sieben
121 END
122 let lines1 =<< trim END1
123 set nocp
124 set display=lastline
125 set cursorlineopt=screenline cursorline nu wrap sbr=>
126 hi CursorLineNr ctermfg=blue
127 25vsp
128 END1
129 let lines2 =<< trim END2
130 call cursor(1,1)
131 END2
132 call extend(lines, lines1)
133 call extend(lines, ["call append(0, ".. string(file_content).. ')'])
134 call extend(lines, lines2)
135 call writefile(lines, filename)
136 " basic test
137 let buf = RunVimInTerminal('-S '. filename, #{rows: 20})
138 call term_wait(buf)
139 call VerifyScreenDump(buf, 'Test_'. filename. '_1', {})
140 call term_sendkeys(buf, "fagj")
141 call term_wait(buf)
142 call VerifyScreenDump(buf, 'Test_'. filename. '_2', {})
143 call term_sendkeys(buf, "gj")
144 call term_wait(buf)
145 call VerifyScreenDump(buf, 'Test_'. filename. '_3', {})
146 call term_sendkeys(buf, "gj")
147 call term_wait(buf)
148 call VerifyScreenDump(buf, 'Test_'. filename. '_4', {})
149 call term_sendkeys(buf, "gj")
150 call term_wait(buf)
151 call VerifyScreenDump(buf, 'Test_'. filename. '_5', {})
152 call term_sendkeys(buf, "gj")
153 call term_wait(buf)
154 call VerifyScreenDump(buf, 'Test_'. filename. '_6', {})
155 " test with set list and cursorlineopt containing number
156 call term_sendkeys(buf, "gg0")
157 call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\<cr>")
158 call VerifyScreenDump(buf, 'Test_'. filename. '_7', {})
159 call term_sendkeys(buf, "fagj")
160 call term_wait(buf)
161 call VerifyScreenDump(buf, 'Test_'. filename. '_8', {})
162 call term_sendkeys(buf, "gj")
163 call term_wait(buf)
164 call VerifyScreenDump(buf, 'Test_'. filename. '_9', {})
165 call term_sendkeys(buf, "gj")
166 call term_wait(buf)
167 call VerifyScreenDump(buf, 'Test_'. filename. '_10', {})
168 call term_sendkeys(buf, "gj")
169 call term_wait(buf)
170 call VerifyScreenDump(buf, 'Test_'. filename. '_11', {})
171 call term_sendkeys(buf, "gj")
172 call term_wait(buf)
173 call VerifyScreenDump(buf, 'Test_'. filename. '_12', {})
174 if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent")
175 " test with set foldcolumn signcoloumn and breakindent
176 call term_sendkeys(buf, "gg0")
177 call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\<cr>")
178 call VerifyScreenDump(buf, 'Test_'. filename. '_13', {})
179 call term_sendkeys(buf, "fagj")
180 call term_wait(buf)
181 call VerifyScreenDump(buf, 'Test_'. filename. '_14', {})
182 call term_sendkeys(buf, "gj")
183 call term_wait(buf)
184 call VerifyScreenDump(buf, 'Test_'. filename. '_15', {})
185 call term_sendkeys(buf, "gj")
186 call term_wait(buf)
187 call VerifyScreenDump(buf, 'Test_'. filename. '_16', {})
188 call term_sendkeys(buf, "gj")
189 call term_wait(buf)
190 call VerifyScreenDump(buf, 'Test_'. filename. '_17', {})
191 call term_sendkeys(buf, "gj")
192 call term_wait(buf)
193 call VerifyScreenDump(buf, 'Test_'. filename. '_18', {})
194 endif
195
196 call StopVimInTerminal(buf)
197 call delete(filename)
198 endfunc