Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 1 | " Test for cursorline and cursorlineopt |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 2 | |
Christian Brabandt | eb380b9 | 2025-07-07 20:53:55 +0200 | [diff] [blame^] | 3 | source util/screendump.vim |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 4 | |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 5 | func s:screen_attr(lnum) abort |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 6 | return map(range(1, 8), 'screenattr(a:lnum, v:val)') |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 7 | endfunc |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 8 | |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 9 | func s:test_windows(h, w) abort |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 10 | call NewWindow(a:h, a:w) |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 11 | endfunc |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 12 | |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 13 | func s:close_windows() abort |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 14 | call CloseWindow() |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 15 | endfunc |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 16 | |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 17 | func s:new_hi() abort |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 18 | redir => save_hi |
| 19 | silent! hi CursorLineNr |
| 20 | redir END |
| 21 | let save_hi = join(split(substitute(save_hi, '\s*xxx\s*', ' ', ''), "\n"), '') |
| 22 | exe 'hi' save_hi 'ctermbg=0 guibg=Black' |
| 23 | return save_hi |
Bram Moolenaar | 97f0eb1 | 2022-10-06 19:49:13 +0100 | [diff] [blame] | 24 | endfunc |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 25 | |
| 26 | func Test_cursorline_highlight1() |
| 27 | let save_hi = s:new_hi() |
| 28 | try |
| 29 | call s:test_windows(10, 20) |
| 30 | call setline(1, repeat(['aaaa'], 10)) |
| 31 | redraw |
| 32 | let attr01 = s:screen_attr(1) |
| 33 | call assert_equal(repeat([attr01[0]], 8), attr01) |
| 34 | |
| 35 | setl number numberwidth=4 |
| 36 | redraw |
| 37 | let attr11 = s:screen_attr(1) |
| 38 | call assert_equal(repeat([attr11[0]], 4), attr11[0:3]) |
| 39 | call assert_equal(repeat([attr11[4]], 4), attr11[4:7]) |
| 40 | call assert_notequal(attr11[0], attr11[4]) |
| 41 | |
| 42 | setl cursorline |
| 43 | redraw |
| 44 | let attr21 = s:screen_attr(1) |
| 45 | let attr22 = s:screen_attr(2) |
| 46 | call assert_equal(repeat([attr21[0]], 4), attr21[0:3]) |
| 47 | call assert_equal(repeat([attr21[4]], 4), attr21[4:7]) |
| 48 | call assert_equal(attr11, attr22) |
| 49 | call assert_notequal(attr22, attr21) |
| 50 | |
| 51 | setl nocursorline relativenumber |
| 52 | redraw |
| 53 | let attr31 = s:screen_attr(1) |
Bram Moolenaar | 49474ca | 2019-10-05 21:57:12 +0200 | [diff] [blame] | 54 | call assert_equal(attr22[0:3], attr31[0:3]) |
Bram Moolenaar | 410e98a | 2019-09-09 22:05:49 +0200 | [diff] [blame] | 55 | call assert_equal(attr11[4:7], attr31[4:7]) |
| 56 | |
| 57 | call s:close_windows() |
| 58 | finally |
| 59 | exe 'hi' save_hi |
| 60 | endtry |
| 61 | endfunc |
| 62 | |
| 63 | func Test_cursorline_highlight2() |
| 64 | CheckOption cursorlineopt |
| 65 | |
| 66 | let save_hi = s:new_hi() |
| 67 | try |
| 68 | call s:test_windows(10, 20) |
| 69 | call setline(1, repeat(['aaaa'], 10)) |
| 70 | redraw |
| 71 | let attr0 = s:screen_attr(1) |
| 72 | call assert_equal(repeat([attr0[0]], 8), attr0) |
| 73 | |
| 74 | setl number |
| 75 | redraw |
| 76 | let attr1 = s:screen_attr(1) |
| 77 | call assert_notequal(attr0[0:3], attr1[0:3]) |
| 78 | call assert_equal(attr0[0:3], attr1[4:7]) |
| 79 | |
| 80 | setl cursorline cursorlineopt=both |
| 81 | redraw |
| 82 | let attr2 = s:screen_attr(1) |
| 83 | call assert_notequal(attr1[0:3], attr2[0:3]) |
| 84 | call assert_notequal(attr1[4:7], attr2[4:7]) |
| 85 | |
| 86 | setl cursorlineopt=line |
| 87 | redraw |
| 88 | let attr3 = s:screen_attr(1) |
| 89 | call assert_equal(attr1[0:3], attr3[0:3]) |
| 90 | call assert_equal(attr2[4:7], attr3[4:7]) |
| 91 | |
| 92 | setl cursorlineopt=number |
| 93 | redraw |
| 94 | let attr4 = s:screen_attr(1) |
| 95 | call assert_equal(attr2[0:3], attr4[0:3]) |
| 96 | call assert_equal(attr1[4:7], attr4[4:7]) |
| 97 | |
| 98 | setl nonumber |
| 99 | redraw |
| 100 | let attr5 = s:screen_attr(1) |
| 101 | call assert_equal(attr0, attr5) |
| 102 | |
| 103 | call s:close_windows() |
| 104 | finally |
| 105 | exe 'hi' save_hi |
| 106 | endtry |
| 107 | endfunc |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 108 | |
| 109 | func Test_cursorline_screenline() |
| 110 | CheckScreendump |
| 111 | CheckOption cursorlineopt |
Bram Moolenaar | c9e7e34 | 2021-07-22 21:33:03 +0200 | [diff] [blame] | 112 | |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 113 | let filename='Xcursorline' |
| 114 | let lines = [] |
| 115 | |
| 116 | let file_content =<< trim END |
| 117 | 1 foooooooo ar einszwei 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) |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 135 | call writefile(lines, filename, 'D') |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 136 | " basic test |
| 137 | let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 138 | call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) |
| 139 | call term_sendkeys(buf, "fagj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 140 | call VerifyScreenDump(buf, 'Test_'. filename. '_2', {}) |
| 141 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 142 | call VerifyScreenDump(buf, 'Test_'. filename. '_3', {}) |
| 143 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 144 | call VerifyScreenDump(buf, 'Test_'. filename. '_4', {}) |
| 145 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 146 | call VerifyScreenDump(buf, 'Test_'. filename. '_5', {}) |
| 147 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 148 | call VerifyScreenDump(buf, 'Test_'. filename. '_6', {}) |
| 149 | " test with set list and cursorlineopt containing number |
| 150 | call term_sendkeys(buf, "gg0") |
| 151 | call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\<cr>") |
| 152 | call VerifyScreenDump(buf, 'Test_'. filename. '_7', {}) |
| 153 | call term_sendkeys(buf, "fagj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 154 | call VerifyScreenDump(buf, 'Test_'. filename. '_8', {}) |
| 155 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 156 | call VerifyScreenDump(buf, 'Test_'. filename. '_9', {}) |
| 157 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 158 | call VerifyScreenDump(buf, 'Test_'. filename. '_10', {}) |
| 159 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 160 | call VerifyScreenDump(buf, 'Test_'. filename. '_11', {}) |
| 161 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 162 | call VerifyScreenDump(buf, 'Test_'. filename. '_12', {}) |
| 163 | if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent") |
Dominique Pelle | 81b573d | 2022-03-22 21:14:55 +0000 | [diff] [blame] | 164 | " test with set foldcolumn signcolumn and breakindent |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 165 | call term_sendkeys(buf, "gg0") |
| 166 | call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\<cr>") |
| 167 | call VerifyScreenDump(buf, 'Test_'. filename. '_13', {}) |
| 168 | call term_sendkeys(buf, "fagj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 169 | call VerifyScreenDump(buf, 'Test_'. filename. '_14', {}) |
| 170 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 171 | call VerifyScreenDump(buf, 'Test_'. filename. '_15', {}) |
| 172 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 173 | call VerifyScreenDump(buf, 'Test_'. filename. '_16', {}) |
| 174 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 175 | call VerifyScreenDump(buf, 'Test_'. filename. '_17', {}) |
| 176 | call term_sendkeys(buf, "gj") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 177 | call VerifyScreenDump(buf, 'Test_'. filename. '_18', {}) |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 178 | call term_sendkeys(buf, ":set breakindent& foldcolumn& signcolumn&\<cr>") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 179 | endif |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 180 | " showbreak should not be highlighted with CursorLine when 'number' is off |
| 181 | call term_sendkeys(buf, "gg0") |
| 182 | call term_sendkeys(buf, ":set list cursorlineopt=screenline listchars=space:-\<cr>") |
| 183 | call term_sendkeys(buf, ":set nonumber\<cr>") |
| 184 | call VerifyScreenDump(buf, 'Test_'. filename. '_19', {}) |
| 185 | call term_sendkeys(buf, "fagj") |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 186 | call VerifyScreenDump(buf, 'Test_'. filename. '_20', {}) |
| 187 | call term_sendkeys(buf, "gj") |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 188 | call VerifyScreenDump(buf, 'Test_'. filename. '_21', {}) |
| 189 | call term_sendkeys(buf, "gj") |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 190 | call VerifyScreenDump(buf, 'Test_'. filename. '_22', {}) |
| 191 | call term_sendkeys(buf, "gj") |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 192 | call VerifyScreenDump(buf, 'Test_'. filename. '_23', {}) |
| 193 | call term_sendkeys(buf, "gj") |
zeertzjq | 4f33bc2 | 2021-08-05 17:57:02 +0200 | [diff] [blame] | 194 | call VerifyScreenDump(buf, 'Test_'. filename. '_24', {}) |
| 195 | call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>") |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 196 | |
| 197 | call StopVimInTerminal(buf) |
Bram Moolenaar | 017ba07 | 2019-09-14 21:01:23 +0200 | [diff] [blame] | 198 | endfunc |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 199 | |
Bram Moolenaar | c9e7e34 | 2021-07-22 21:33:03 +0200 | [diff] [blame] | 200 | func Test_cursorline_redraw() |
| 201 | CheckScreendump |
| 202 | CheckOption cursorlineopt |
| 203 | |
| 204 | let textlines =<< END |
| 205 | When the option is a list of flags, {value} must be |
| 206 | exactly as they appear in the option. Remove flags |
| 207 | one by one to avoid problems. |
| 208 | Also see |:set-args| above. |
| 209 | |
| 210 | The {option} arguments to ":set" may be repeated. For example: > |
| 211 | :set ai nosi sw=3 ts=3 |
| 212 | If you make an error in one of the arguments, an error message will be given |
| 213 | and the following arguments will be ignored. |
| 214 | |
| 215 | *:set-verbose* |
| 216 | When 'verbose' is non-zero, displaying an option value will also tell where it |
| 217 | was last set. Example: > |
| 218 | :verbose set shiftwidth cindent? |
| 219 | < shiftwidth=4 ~ |
| 220 | Last set from modeline line 1 ~ |
| 221 | cindent ~ |
| 222 | Last set from /usr/local/share/vim/vim60/ftplugin/c.vim line 30 ~ |
| 223 | This is only done when specific option values are requested, not for ":verbose |
| 224 | set all" or ":verbose set" without an argument. |
| 225 | When the option was set by hand there is no "Last set" message. |
| 226 | When the option was set while executing a function, user command or |
| 227 | END |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 228 | call writefile(textlines, 'Xtextfile', 'D') |
Bram Moolenaar | c9e7e34 | 2021-07-22 21:33:03 +0200 | [diff] [blame] | 229 | |
| 230 | let script =<< trim END |
| 231 | set cursorline scrolloff=2 |
| 232 | normal 12G |
| 233 | END |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 234 | call writefile(script, 'Xscript', 'D') |
Bram Moolenaar | c9e7e34 | 2021-07-22 21:33:03 +0200 | [diff] [blame] | 235 | |
| 236 | let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40}) |
| 237 | call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {}) |
| 238 | call term_sendkeys(buf, "zt") |
| 239 | call TermWait(buf) |
| 240 | call term_sendkeys(buf, "\<C-U>") |
| 241 | call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {}) |
| 242 | |
| 243 | call StopVimInTerminal(buf) |
Bram Moolenaar | c9e7e34 | 2021-07-22 21:33:03 +0200 | [diff] [blame] | 244 | endfunc |
| 245 | |
Bram Moolenaar | e7a74d5 | 2022-03-19 11:10:15 +0000 | [diff] [blame] | 246 | func Test_cursorline_callback() |
| 247 | CheckScreendump |
| 248 | CheckFeature timers |
| 249 | |
| 250 | let lines =<< trim END |
| 251 | call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd']) |
| 252 | set cursorline |
| 253 | call cursor(4, 1) |
| 254 | |
| 255 | func Func(timer) |
| 256 | call cursor(2, 1) |
| 257 | endfunc |
| 258 | |
| 259 | call timer_start(300, 'Func') |
| 260 | END |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 261 | call writefile(lines, 'Xcul_timer', 'D') |
Bram Moolenaar | e7a74d5 | 2022-03-19 11:10:15 +0000 | [diff] [blame] | 262 | |
| 263 | let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8}) |
| 264 | call TermWait(buf, 310) |
| 265 | call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {}) |
| 266 | |
| 267 | call StopVimInTerminal(buf) |
Bram Moolenaar | e7a74d5 | 2022-03-19 11:10:15 +0000 | [diff] [blame] | 268 | endfunc |
| 269 | |
zeertzjq | 86dc4f8 | 2024-09-14 10:37:17 +0200 | [diff] [blame] | 270 | func Test_cursorline_screenline_resize() |
| 271 | CheckScreendump |
| 272 | |
| 273 | let lines =<< trim END |
| 274 | 50vnew |
| 275 | call setline(1, repeat('xyz ', 30)) |
| 276 | setlocal number cursorline cursorlineopt=screenline |
| 277 | normal! $ |
| 278 | END |
| 279 | call writefile(lines, 'Xcul_screenline_resize', 'D') |
| 280 | |
| 281 | let buf = RunVimInTerminal('-S Xcul_screenline_resize', #{rows: 8}) |
| 282 | call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_1', {}) |
| 283 | call term_sendkeys(buf, ":vertical resize -4\<CR>") |
| 284 | call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_2', {}) |
| 285 | call term_sendkeys(buf, ":set cpoptions+=n\<CR>") |
| 286 | call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_3', {}) |
| 287 | |
| 288 | call StopVimInTerminal(buf) |
| 289 | endfunc |
| 290 | |
Bram Moolenaar | bf269ed | 2022-03-26 13:28:14 +0000 | [diff] [blame] | 291 | func Test_cursorline_screenline_update() |
| 292 | CheckScreendump |
| 293 | |
| 294 | let lines =<< trim END |
| 295 | call setline(1, repeat('xyz ', 30)) |
| 296 | set cursorline cursorlineopt=screenline |
| 297 | inoremap <F2> <Cmd>call cursor(1, 1)<CR> |
| 298 | END |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 299 | call writefile(lines, 'Xcul_screenline', 'D') |
Bram Moolenaar | bf269ed | 2022-03-26 13:28:14 +0000 | [diff] [blame] | 300 | |
| 301 | let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) |
| 302 | call term_sendkeys(buf, "A") |
| 303 | call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {}) |
| 304 | call term_sendkeys(buf, "\<F2>") |
| 305 | call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {}) |
| 306 | call term_sendkeys(buf, "\<Esc>") |
| 307 | |
| 308 | call StopVimInTerminal(buf) |
Bram Moolenaar | bf269ed | 2022-03-26 13:28:14 +0000 | [diff] [blame] | 309 | endfunc |
| 310 | |
zeertzjq | 59149f0 | 2024-09-14 10:40:29 +0200 | [diff] [blame] | 311 | func Test_cursorline_screenline_zero_width() |
| 312 | CheckOption foldcolumn |
| 313 | |
| 314 | set cursorline culopt=screenline winminwidth=1 foldcolumn=1 |
| 315 | " This used to crash Vim |
| 316 | 1vnew | redraw |
| 317 | |
| 318 | bwipe! |
| 319 | set cursorline& culopt& winminwidth& foldcolumn& |
| 320 | endfunc |
| 321 | |
Christian Brabandt | 2c645e8 | 2022-04-20 14:52:01 +0100 | [diff] [blame] | 322 | func Test_cursorline_cursorbind_horizontal_scroll() |
| 323 | CheckScreendump |
| 324 | |
| 325 | let lines =<< trim END |
Christian Brabandt | 3fd7480 | 2022-04-20 22:07:41 +0100 | [diff] [blame] | 326 | call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' .. |
Bram Moolenaar | 6ed545e | 2022-05-09 20:09:23 +0100 | [diff] [blame] | 327 | \ ' nn oo pp qq rr ss tt uu vv ww xx yy zz') |
Christian Brabandt | 2c645e8 | 2022-04-20 14:52:01 +0100 | [diff] [blame] | 328 | set nowrap |
| 329 | " The following makes the cursor apparent on the screen dump |
| 330 | set sidescroll=1 cursorcolumn |
| 331 | " add empty lines, required for cursorcolumn |
| 332 | call append(1, ['','','','']) |
| 333 | 20vsp |
| 334 | windo :set cursorbind |
| 335 | END |
Bram Moolenaar | 45bbaef | 2022-09-08 16:39:22 +0100 | [diff] [blame] | 336 | call writefile(lines, 'Xhor_scroll', 'D') |
Christian Brabandt | 2c645e8 | 2022-04-20 14:52:01 +0100 | [diff] [blame] | 337 | |
| 338 | let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8}) |
| 339 | call term_sendkeys(buf, "20l") |
| 340 | call VerifyScreenDump(buf, 'Test_hor_scroll_1', {}) |
| 341 | call term_sendkeys(buf, "10l") |
| 342 | call VerifyScreenDump(buf, 'Test_hor_scroll_2', {}) |
| 343 | call term_sendkeys(buf, ":windo :set cursorline\<cr>") |
| 344 | call term_sendkeys(buf, "0") |
| 345 | call term_sendkeys(buf, "20l") |
| 346 | call VerifyScreenDump(buf, 'Test_hor_scroll_3', {}) |
| 347 | call term_sendkeys(buf, "10l") |
| 348 | call VerifyScreenDump(buf, 'Test_hor_scroll_4', {}) |
Christian Brabandt | 3fd7480 | 2022-04-20 22:07:41 +0100 | [diff] [blame] | 349 | call term_sendkeys(buf, ":windo :set nocursorline nocursorcolumn\<cr>") |
| 350 | call term_sendkeys(buf, "0") |
| 351 | call term_sendkeys(buf, "40l") |
| 352 | call VerifyScreenDump(buf, 'Test_hor_scroll_5', {}) |
Christian Brabandt | 2c645e8 | 2022-04-20 14:52:01 +0100 | [diff] [blame] | 353 | |
| 354 | call StopVimInTerminal(buf) |
Christian Brabandt | 2c645e8 | 2022-04-20 14:52:01 +0100 | [diff] [blame] | 355 | endfunc |
| 356 | |
Bram Moolenaar | e7a74d5 | 2022-03-19 11:10:15 +0000 | [diff] [blame] | 357 | |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 358 | " vim: shiftwidth=2 sts=2 expandtab |