Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 1 | " Test for displaying stuff |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 2 | |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 3 | if !has('gui_running') && has('unix') |
| 4 | set term=ansi |
| 5 | endif |
| 6 | |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 7 | source view_util.vim |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 8 | source check.vim |
| 9 | source screendump.vim |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 10 | |
Bram Moolenaar | 1e11536 | 2019-01-09 23:01:02 +0100 | [diff] [blame] | 11 | func Test_display_foldcolumn() |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 12 | CheckFeature folding |
| 13 | |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 14 | new |
| 15 | vnew |
| 16 | vert resize 25 |
Bram Moolenaar | 7089237 | 2016-12-09 19:51:49 +0100 | [diff] [blame] | 17 | call assert_equal(25, winwidth(winnr())) |
| 18 | set isprint=@ |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 19 | |
| 20 | 1put='e more noise blah blah more stuff here' |
| 21 | |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 22 | let expect = [ |
| 23 | \ "e more noise blah blah<82", |
| 24 | \ "> more stuff here " |
| 25 | \ ] |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 26 | |
| 27 | call cursor(2, 1) |
| 28 | norm! zt |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 29 | let lines = ScreenLines([1,2], winwidth(0)) |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 30 | call assert_equal(expect, lines) |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 31 | set fdc=2 |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 32 | let lines = ScreenLines([1,2], winwidth(0)) |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 33 | let expect = [ |
| 34 | \ " e more noise blah blah<", |
| 35 | \ " 82> more stuff here " |
| 36 | \ ] |
| 37 | call assert_equal(expect, lines) |
Bram Moolenaar | 6270660 | 2016-12-09 19:28:48 +0100 | [diff] [blame] | 38 | |
| 39 | quit! |
| 40 | quit! |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 41 | endfunc |
| 42 | |
Bram Moolenaar | 1e11536 | 2019-01-09 23:01:02 +0100 | [diff] [blame] | 43 | func Test_display_foldtext_mbyte() |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 44 | CheckFeature folding |
| 45 | |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 46 | call NewWindow(10, 40) |
| 47 | call append(0, range(1,20)) |
| 48 | exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2" |
| 49 | call cursor(2, 1) |
| 50 | norm! zf13G |
| 51 | let lines=ScreenLines([1,3], winwidth(0)+1) |
| 52 | let expect=[ |
| 53 | \ " 1 \u2502", |
| 54 | \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502", |
| 55 | \ " 14 \u2502", |
| 56 | \ ] |
| 57 | call assert_equal(expect, lines) |
Bram Moolenaar | 8da1e6c | 2017-03-29 20:38:59 +0200 | [diff] [blame] | 58 | |
| 59 | set fillchars=fold:-,vert:\| |
| 60 | let lines=ScreenLines([1,3], winwidth(0)+1) |
| 61 | let expect=[ |
| 62 | \ " 1 |", |
| 63 | \ "+ +-- 12 lines: 2". repeat("-", 23). "|", |
| 64 | \ " 14 |", |
| 65 | \ ] |
| 66 | call assert_equal(expect, lines) |
| 67 | |
Bram Moolenaar | c6cd840 | 2017-03-29 14:40:47 +0200 | [diff] [blame] | 68 | set foldtext& fillchars& foldmethod& fdc& |
| 69 | bw! |
| 70 | endfunc |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 71 | |
| 72 | " check that win_ins_lines() and win_del_lines() work when t_cs is empty. |
| 73 | func Test_scroll_without_region() |
| 74 | CheckScreendump |
| 75 | |
| 76 | let lines =<< trim END |
| 77 | call setline(1, range(1, 20)) |
| 78 | set t_cs= |
| 79 | set laststatus=2 |
| 80 | END |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 81 | call writefile(lines, 'Xtestscroll', 'D') |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 82 | let buf = RunVimInTerminal('-S Xtestscroll', #{rows: 10}) |
| 83 | |
| 84 | call VerifyScreenDump(buf, 'Test_scroll_no_region_1', {}) |
| 85 | |
| 86 | call term_sendkeys(buf, ":3delete\<cr>") |
| 87 | call VerifyScreenDump(buf, 'Test_scroll_no_region_2', {}) |
| 88 | |
| 89 | call term_sendkeys(buf, ":4put\<cr>") |
| 90 | call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {}) |
| 91 | |
Bram Moolenaar | 7cc5351 | 2019-08-03 23:30:21 +0200 | [diff] [blame] | 92 | call term_sendkeys(buf, ":undo\<cr>") |
| 93 | call term_sendkeys(buf, ":undo\<cr>") |
| 94 | call term_sendkeys(buf, ":set laststatus=0\<cr>") |
| 95 | call VerifyScreenDump(buf, 'Test_scroll_no_region_4', {}) |
| 96 | |
| 97 | call term_sendkeys(buf, ":3delete\<cr>") |
| 98 | call VerifyScreenDump(buf, 'Test_scroll_no_region_5', {}) |
| 99 | |
| 100 | call term_sendkeys(buf, ":4put\<cr>") |
| 101 | call VerifyScreenDump(buf, 'Test_scroll_no_region_6', {}) |
| 102 | |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 103 | " clean up |
| 104 | call StopVimInTerminal(buf) |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 105 | endfunc |
Bram Moolenaar | bffba7f | 2019-09-20 17:00:17 +0200 | [diff] [blame] | 106 | |
| 107 | func Test_display_listchars_precedes() |
| 108 | call NewWindow(10, 10) |
| 109 | " Need a physical line that wraps over the complete |
| 110 | " window size |
| 111 | call append(0, repeat('aaa aaa aa ', 10)) |
| 112 | call append(1, repeat(['bbb bbb bbb bbb'], 2)) |
| 113 | " remove blank trailing line |
| 114 | $d |
| 115 | set list nowrap |
| 116 | call cursor(1, 1) |
| 117 | " move to end of line and scroll 2 characters back |
| 118 | norm! $2zh |
| 119 | let lines=ScreenLines([1,4], winwidth(0)+1) |
| 120 | let expect = [ |
| 121 | \ " aaa aa $ |", |
| 122 | \ "$ |", |
| 123 | \ "$ |", |
| 124 | \ "~ |", |
| 125 | \ ] |
| 126 | call assert_equal(expect, lines) |
| 127 | set list listchars+=precedes:< nowrap |
| 128 | call cursor(1, 1) |
| 129 | " move to end of line and scroll 2 characters back |
| 130 | norm! $2zh |
| 131 | let lines = ScreenLines([1,4], winwidth(0)+1) |
| 132 | let expect = [ |
| 133 | \ "<aaa aa $ |", |
| 134 | \ "< |", |
| 135 | \ "< |", |
| 136 | \ "~ |", |
| 137 | \ ] |
| 138 | call assert_equal(expect, lines) |
| 139 | set wrap |
| 140 | call cursor(1, 1) |
| 141 | " the complete line should be displayed in the window |
| 142 | norm! $ |
| 143 | |
| 144 | let lines = ScreenLines([1,10], winwidth(0)+1) |
| 145 | let expect = [ |
Bram Moolenaar | 0466d39 | 2022-10-03 17:07:34 +0100 | [diff] [blame] | 146 | \ "<<<a aaa a|", |
Bram Moolenaar | bffba7f | 2019-09-20 17:00:17 +0200 | [diff] [blame] | 147 | \ "a aaa aaa |", |
| 148 | \ "aa aaa aaa|", |
| 149 | \ " aa aaa aa|", |
| 150 | \ "a aa aaa a|", |
| 151 | \ "aa aa aaa |", |
| 152 | \ "aaa aa aaa|", |
| 153 | \ " aaa aa aa|", |
| 154 | \ "a aaa aa a|", |
| 155 | \ "aa aaa aa |", |
| 156 | \ ] |
| 157 | call assert_equal(expect, lines) |
| 158 | set list& listchars& wrap& |
| 159 | bw! |
| 160 | endfunc |
Bram Moolenaar | 2868668 | 2019-10-24 15:12:37 +0200 | [diff] [blame] | 161 | |
| 162 | " Check that win_lines() works correctly with the number_only parameter=TRUE |
| 163 | " should break early to optimize cost of drawing, but needs to make sure |
| 164 | " that the number column is correctly highlighted. |
| 165 | func Test_scroll_CursorLineNr_update() |
| 166 | CheckScreendump |
| 167 | |
| 168 | let lines =<< trim END |
| 169 | hi CursorLineNr ctermfg=73 ctermbg=236 |
| 170 | set nu rnu cursorline cursorlineopt=number |
| 171 | exe ":norm! o\<esc>110ia\<esc>" |
| 172 | END |
| 173 | let filename = 'Xdrawscreen' |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 174 | call writefile(lines, filename, 'D') |
Bram Moolenaar | 2868668 | 2019-10-24 15:12:37 +0200 | [diff] [blame] | 175 | let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50}) |
| 176 | call term_sendkeys(buf, "k") |
Bram Moolenaar | 2868668 | 2019-10-24 15:12:37 +0200 | [diff] [blame] | 177 | call VerifyScreenDump(buf, 'Test_winline_rnu', {}) |
| 178 | |
| 179 | " clean up |
| 180 | call StopVimInTerminal(buf) |
Bram Moolenaar | 2868668 | 2019-10-24 15:12:37 +0200 | [diff] [blame] | 181 | endfunc |
Bram Moolenaar | 0efd1bd | 2019-12-11 19:00:04 +0100 | [diff] [blame] | 182 | |
| 183 | " check a long file name does not result in the hit-enter prompt |
| 184 | func Test_edit_long_file_name() |
| 185 | CheckScreendump |
| 186 | |
Bram Moolenaar | 6e43b30 | 2019-12-14 17:53:27 +0100 | [diff] [blame] | 187 | let longName = 'x'->repeat(min([&columns, 255])) |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 188 | call writefile([], longName, 'D') |
Bram Moolenaar | 0efd1bd | 2019-12-11 19:00:04 +0100 | [diff] [blame] | 189 | let buf = RunVimInTerminal('-N -u NONE ' .. longName, #{rows: 8}) |
| 190 | |
| 191 | call VerifyScreenDump(buf, 'Test_long_file_name_1', {}) |
| 192 | |
Bram Moolenaar | 0efd1bd | 2019-12-11 19:00:04 +0100 | [diff] [blame] | 193 | " clean up |
| 194 | call StopVimInTerminal(buf) |
Bram Moolenaar | 0efd1bd | 2019-12-11 19:00:04 +0100 | [diff] [blame] | 195 | endfunc |
| 196 | |
Bram Moolenaar | 32ee627 | 2020-06-10 14:16:49 +0200 | [diff] [blame] | 197 | func Test_unprintable_fileformats() |
| 198 | CheckScreendump |
| 199 | |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 200 | call writefile(["unix\r", "two"], 'Xunix.txt', 'D') |
| 201 | call writefile(["mac\r", "two"], 'Xmac.txt', 'D') |
Bram Moolenaar | 32ee627 | 2020-06-10 14:16:49 +0200 | [diff] [blame] | 202 | let lines =<< trim END |
| 203 | edit Xunix.txt |
| 204 | split Xmac.txt |
| 205 | edit ++ff=mac |
| 206 | END |
| 207 | let filename = 'Xunprintable' |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 208 | call writefile(lines, filename, 'D') |
Bram Moolenaar | 32ee627 | 2020-06-10 14:16:49 +0200 | [diff] [blame] | 209 | let buf = RunVimInTerminal('-S '.filename, #{rows: 9, cols: 50}) |
| 210 | call VerifyScreenDump(buf, 'Test_display_unprintable_01', {}) |
| 211 | call term_sendkeys(buf, "\<C-W>\<C-W>\<C-L>") |
| 212 | call VerifyScreenDump(buf, 'Test_display_unprintable_02', {}) |
| 213 | |
| 214 | " clean up |
| 215 | call StopVimInTerminal(buf) |
Bram Moolenaar | 32ee627 | 2020-06-10 14:16:49 +0200 | [diff] [blame] | 216 | endfunc |
Bram Moolenaar | f8992d4 | 2020-08-01 19:14:13 +0200 | [diff] [blame] | 217 | |
| 218 | " Test for scrolling that modifies buffer during visual block |
| 219 | func Test_visual_block_scroll() |
| 220 | CheckScreendump |
| 221 | |
| 222 | let lines =<< trim END |
| 223 | source $VIMRUNTIME/plugin/matchparen.vim |
| 224 | set scrolloff=1 |
| 225 | call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}']) |
| 226 | call cursor(5, 1) |
| 227 | END |
| 228 | |
| 229 | let filename = 'Xvisualblockmodifiedscroll' |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 230 | call writefile(lines, filename, 'D') |
Bram Moolenaar | f8992d4 | 2020-08-01 19:14:13 +0200 | [diff] [blame] | 231 | |
| 232 | let buf = RunVimInTerminal('-S '.filename, #{rows: 7}) |
| 233 | call term_sendkeys(buf, "V\<C-D>\<C-D>") |
| 234 | |
| 235 | call VerifyScreenDump(buf, 'Test_display_visual_block_scroll', {}) |
| 236 | |
| 237 | call StopVimInTerminal(buf) |
Bram Moolenaar | f8992d4 | 2020-08-01 19:14:13 +0200 | [diff] [blame] | 238 | endfunc |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 239 | |
Bram Moolenaar | 9dc1917 | 2020-08-19 20:19:48 +0200 | [diff] [blame] | 240 | func Test_display_scroll_at_topline() |
| 241 | CheckScreendump |
| 242 | |
| 243 | let buf = RunVimInTerminal('', #{cols: 20}) |
| 244 | call term_sendkeys(buf, ":call setline(1, repeat('a', 21))\<CR>") |
Bram Moolenaar | 733d259 | 2020-08-20 18:59:06 +0200 | [diff] [blame] | 245 | call TermWait(buf) |
Bram Moolenaar | 9dc1917 | 2020-08-19 20:19:48 +0200 | [diff] [blame] | 246 | call term_sendkeys(buf, "O\<Esc>") |
| 247 | call VerifyScreenDump(buf, 'Test_display_scroll_at_topline', #{rows: 4}) |
| 248 | |
| 249 | call StopVimInTerminal(buf) |
| 250 | endfunc |
| 251 | |
Bram Moolenaar | abb6fbd | 2022-03-25 15:42:27 +0000 | [diff] [blame] | 252 | func Test_display_scroll_update_visual() |
| 253 | CheckScreendump |
| 254 | |
| 255 | let lines =<< trim END |
| 256 | set scrolloff=0 |
| 257 | call setline(1, repeat(['foo'], 10)) |
| 258 | call sign_define('foo', { 'text': '>' }) |
| 259 | call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 }) |
| 260 | call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 }) |
| 261 | autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif |
| 262 | END |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 263 | call writefile(lines, 'XupdateVisual.vim', 'D') |
Bram Moolenaar | abb6fbd | 2022-03-25 15:42:27 +0000 | [diff] [blame] | 264 | |
| 265 | let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60}) |
| 266 | call term_sendkeys(buf, "VG7kk") |
| 267 | call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {}) |
| 268 | |
| 269 | call StopVimInTerminal(buf) |
Bram Moolenaar | abb6fbd | 2022-03-25 15:42:27 +0000 | [diff] [blame] | 270 | endfunc |
| 271 | |
Bram Moolenaar | a98f8a2 | 2021-02-13 18:24:23 +0100 | [diff] [blame] | 272 | " Test for 'eob' (EndOfBuffer) item in 'fillchars' |
| 273 | func Test_eob_fillchars() |
| 274 | " default value |
| 275 | call assert_match('eob:\~', &fillchars) |
| 276 | " invalid values |
| 277 | call assert_fails(':set fillchars=eob:', 'E474:') |
| 278 | call assert_fails(':set fillchars=eob:xy', 'E474:') |
| 279 | call assert_fails(':set fillchars=eob:\255', 'E474:') |
| 280 | call assert_fails(':set fillchars=eob:<ff>', 'E474:') |
zeertzjq | 60618c8 | 2021-12-18 15:32:46 +0000 | [diff] [blame] | 281 | call assert_fails(":set fillchars=eob:\x01", 'E474:') |
| 282 | call assert_fails(':set fillchars=eob:\\x01', 'E474:') |
Bram Moolenaar | a98f8a2 | 2021-02-13 18:24:23 +0100 | [diff] [blame] | 283 | " default is ~ |
| 284 | new |
Bram Moolenaar | 2cec027 | 2021-03-22 17:30:47 +0100 | [diff] [blame] | 285 | redraw |
Bram Moolenaar | a98f8a2 | 2021-02-13 18:24:23 +0100 | [diff] [blame] | 286 | call assert_equal('~', Screenline(2)) |
| 287 | set fillchars=eob:+ |
Bram Moolenaar | 2cec027 | 2021-03-22 17:30:47 +0100 | [diff] [blame] | 288 | redraw |
Bram Moolenaar | a98f8a2 | 2021-02-13 18:24:23 +0100 | [diff] [blame] | 289 | call assert_equal('+', Screenline(2)) |
| 290 | set fillchars=eob:\ |
Bram Moolenaar | 2cec027 | 2021-03-22 17:30:47 +0100 | [diff] [blame] | 291 | redraw |
Bram Moolenaar | a98f8a2 | 2021-02-13 18:24:23 +0100 | [diff] [blame] | 292 | call assert_equal(' ', nr2char(screenchar(2, 1))) |
| 293 | set fillchars& |
| 294 | close |
| 295 | endfunc |
| 296 | |
Bram Moolenaar | 3aca5a6 | 2021-02-17 13:14:07 +0100 | [diff] [blame] | 297 | " Test for 'foldopen', 'foldclose' and 'foldsep' in 'fillchars' |
| 298 | func Test_fold_fillchars() |
| 299 | new |
| 300 | set fdc=2 foldenable foldmethod=manual |
| 301 | call setline(1, ['one', 'two', 'three', 'four', 'five']) |
| 302 | 2,4fold |
| 303 | " First check for the default setting for a closed fold |
| 304 | let lines = ScreenLines([1, 3], 8) |
| 305 | let expected = [ |
| 306 | \ ' one ', |
| 307 | \ '+ +-- 3', |
| 308 | \ ' five ' |
| 309 | \ ] |
| 310 | call assert_equal(expected, lines) |
| 311 | normal 2Gzo |
| 312 | " check the characters for an open fold |
| 313 | let lines = ScreenLines([1, 5], 8) |
| 314 | let expected = [ |
| 315 | \ ' one ', |
| 316 | \ '- two ', |
| 317 | \ '| three ', |
| 318 | \ '| four ', |
| 319 | \ ' five ' |
| 320 | \ ] |
| 321 | call assert_equal(expected, lines) |
| 322 | |
| 323 | " change the setting |
| 324 | set fillchars=vert:\|,fold:-,eob:~,foldopen:[,foldclose:],foldsep:- |
| 325 | |
| 326 | " check the characters for an open fold |
| 327 | let lines = ScreenLines([1, 5], 8) |
| 328 | let expected = [ |
| 329 | \ ' one ', |
| 330 | \ '[ two ', |
| 331 | \ '- three ', |
| 332 | \ '- four ', |
| 333 | \ ' five ' |
| 334 | \ ] |
| 335 | call assert_equal(expected, lines) |
| 336 | |
| 337 | " check the characters for a closed fold |
| 338 | normal 2Gzc |
| 339 | let lines = ScreenLines([1, 3], 8) |
| 340 | let expected = [ |
| 341 | \ ' one ', |
| 342 | \ '] +-- 3', |
| 343 | \ ' five ' |
| 344 | \ ] |
| 345 | call assert_equal(expected, lines) |
| 346 | |
| 347 | %bw! |
| 348 | set fillchars& fdc& foldmethod& foldenable& |
| 349 | endfunc |
| 350 | |
Bram Moolenaar | 96ba25a | 2022-07-04 17:34:33 +0100 | [diff] [blame] | 351 | func Test_local_fillchars() |
| 352 | CheckScreendump |
| 353 | |
| 354 | let lines =<< trim END |
| 355 | call setline(1, ['window 1']->repeat(3)) |
| 356 | setlocal fillchars=stl:1,stlnc:a,vert:=,eob:x |
| 357 | vnew |
| 358 | call setline(1, ['window 2']->repeat(3)) |
| 359 | setlocal fillchars=stl:2,stlnc:b,vert:+,eob:y |
| 360 | new |
| 361 | wincmd J |
| 362 | call setline(1, ['window 3']->repeat(3)) |
| 363 | setlocal fillchars=stl:3,stlnc:c,vert:<,eob:z |
| 364 | vnew |
| 365 | call setline(1, ['window 4']->repeat(3)) |
| 366 | setlocal fillchars=stl:4,stlnc:d,vert:>,eob:o |
| 367 | END |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 368 | call writefile(lines, 'Xdisplayfillchars', 'D') |
Bram Moolenaar | 96ba25a | 2022-07-04 17:34:33 +0100 | [diff] [blame] | 369 | let buf = RunVimInTerminal('-S Xdisplayfillchars', #{rows: 12}) |
| 370 | call VerifyScreenDump(buf, 'Test_display_fillchars_1', {}) |
| 371 | |
| 372 | call term_sendkeys(buf, ":wincmd k\r") |
| 373 | call VerifyScreenDump(buf, 'Test_display_fillchars_2', {}) |
| 374 | |
| 375 | call StopVimInTerminal(buf) |
Bram Moolenaar | 96ba25a | 2022-07-04 17:34:33 +0100 | [diff] [blame] | 376 | endfunc |
| 377 | |
Bram Moolenaar | a06e345 | 2021-05-29 17:56:37 +0200 | [diff] [blame] | 378 | func Test_display_linebreak_breakat() |
| 379 | new |
| 380 | vert resize 25 |
| 381 | let _breakat = &breakat |
| 382 | setl signcolumn=yes linebreak breakat=) showbreak=+\ |
| 383 | call setline(1, repeat('x', winwidth(0) - 2) .. ')abc') |
| 384 | let lines = ScreenLines([1, 2], 25) |
| 385 | let expected = [ |
| 386 | \ ' xxxxxxxxxxxxxxxxxxxxxxx', |
| 387 | \ ' + )abc ' |
| 388 | \ ] |
| 389 | call assert_equal(expected, lines) |
| 390 | %bw! |
| 391 | let &breakat=_breakat |
| 392 | endfunc |
| 393 | |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 394 | func Run_Test_display_lastline(euro) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 395 | let lines =<< trim END |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 396 | call setline(1, ['aaa', 'b'->repeat(200)]) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 397 | set display=truncate |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 398 | |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 399 | vsplit |
| 400 | 100wincmd < |
| 401 | END |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 402 | if a:euro != '' |
| 403 | let lines[2] = 'set fillchars=vert:\|,lastline:€' |
| 404 | endif |
Bram Moolenaar | 5917341 | 2022-09-20 22:01:33 +0100 | [diff] [blame] | 405 | call writefile(lines, 'XdispLastline', 'D') |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 406 | let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10}) |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 407 | call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}1', {}) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 408 | |
| 409 | call term_sendkeys(buf, ":set display=lastline\<CR>") |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 410 | call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}2', {}) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 411 | |
| 412 | call term_sendkeys(buf, ":100wincmd >\<CR>") |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 413 | call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}3', {}) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 414 | |
| 415 | call term_sendkeys(buf, ":set display=truncate\<CR>") |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 416 | call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}4', {}) |
| 417 | |
| 418 | call term_sendkeys(buf, ":close\<CR>") |
| 419 | call term_sendkeys(buf, ":3split\<CR>") |
| 420 | call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}5', {}) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 421 | |
| 422 | call StopVimInTerminal(buf) |
Bram Moolenaar | cee9c84 | 2022-04-09 12:40:13 +0100 | [diff] [blame] | 423 | endfunc |
| 424 | |
Bram Moolenaar | 4ba5f1d | 2022-10-04 14:36:29 +0100 | [diff] [blame] | 425 | func Test_display_lastline() |
| 426 | CheckScreendump |
| 427 | |
| 428 | call Run_Test_display_lastline('') |
| 429 | call Run_Test_display_lastline('euro_') |
| 430 | |
| 431 | call assert_fails(':set fillchars=lastline:', 'E474:') |
| 432 | call assert_fails(':set fillchars=lastline:〇', 'E474:') |
| 433 | endfunc |
| 434 | |
Bram Moolenaar | a06e345 | 2021-05-29 17:56:37 +0200 | [diff] [blame] | 435 | |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 436 | " vim: shiftwidth=2 sts=2 expandtab |