robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
38.3 KiB806 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3local Screen = require('test.functional.ui.screen')
4
5local describe, it, before_each = t.describe, t.it, t.before_each
6local clear = n.clear
7local command = n.command
8local exec = n.exec
9local feed = n.feed
10local api = n.api
11
12local expect_pos = function(row, col)
13  return t.eq({ row, col }, n.eval('[screenrow(), screencol()]'))
14end
15
16describe('Conceal', function()
17  before_each(function()
18    clear()
19    command('set nohlsearch')
20  end)
21
22  -- oldtest: Test_conceal_two_windows()
23  it('works', function()
24    local screen = Screen.new(75, 12)
25    exec([[
26      let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
27      call setline(1, lines)
28      syntax match test /|hidden|/ conceal
29      set conceallevel=2
30      set concealcursor=
31      exe "normal /here\r"
32      new
33      call setline(1, lines)
34      call setline(4, "Second window")
35      syntax match test /|hidden|/ conceal
36      set conceallevel=2
37      set concealcursor=nc
38      exe "normal /here\r"
39    ]])
40
41    -- Check that cursor line is concealed
42    screen:expect([[
43      one one one one one                                                        |
44      two  ^here                                                                  |
45      three  three                                                               |
46      Second window                                                              |
47      {1:~                                                                          }|
48      {3:[No Name] [+]                                                              }|
49      one one one one one                                                        |
50      two  here                                                                  |
51      three  three                                                               |
52      {1:~                                                                          }|
53      {2:[No Name] [+]                                                              }|
54      /here                                                                      |
55    ]])
56
57    -- Check that with concealed text vertical cursor movement is correct.
58    feed('k')
59    screen:expect([[
60      one one one o^ne one                                                        |
61      two  here                                                                  |
62      three  three                                                               |
63      Second window                                                              |
64      {1:~                                                                          }|
65      {3:[No Name] [+]                                                              }|
66      one one one one one                                                        |
67      two  here                                                                  |
68      three  three                                                               |
69      {1:~                                                                          }|
70      {2:[No Name] [+]                                                              }|
71      /here                                                                      |
72    ]])
73
74    -- Check that with cursor line is not concealed
75    feed('j')
76    command('set concealcursor=')
77    screen:expect([[
78      one one one one one                                                        |
79      two |hidden| ^here                                                          |
80      three  three                                                               |
81      Second window                                                              |
82      {1:~                                                                          }|
83      {3:[No Name] [+]                                                              }|
84      one one one one one                                                        |
85      two  here                                                                  |
86      three  three                                                               |
87      {1:~                                                                          }|
88      {2:[No Name] [+]                                                              }|
89      /here                                                                      |
90    ]])
91
92    -- Check that with cursor line is not concealed when moving cursor down
93    feed('j')
94    screen:expect([[
95      one one one one one                                                        |
96      two  here                                                                  |
97      three |hidden^| three                                                       |
98      Second window                                                              |
99      {1:~                                                                          }|
100      {3:[No Name] [+]                                                              }|
101      one one one one one                                                        |
102      two  here                                                                  |
103      three  three                                                               |
104      {1:~                                                                          }|
105      {2:[No Name] [+]                                                              }|
106      /here                                                                      |
107    ]])
108
109    -- Check that with cursor line is not concealed when switching windows
110    feed('<C-W><C-W>')
111    screen:expect([[
112      one one one one one                                                        |
113      two  here                                                                  |
114      three  three                                                               |
115      Second window                                                              |
116      {1:~                                                                          }|
117      {2:[No Name] [+]                                                              }|
118      one one one one one                                                        |
119      two |hidden| ^here                                                          |
120      three  three                                                               |
121      {1:~                                                                          }|
122      {3:[No Name] [+]                                                              }|
123      /here                                                                      |
124    ]])
125
126    -- Check that with cursor line is only concealed in Normal mode
127    command('set concealcursor=n')
128    screen:expect([[
129      one one one one one                                                        |
130      two  here                                                                  |
131      three  three                                                               |
132      Second window                                                              |
133      {1:~                                                                          }|
134      {2:[No Name] [+]                                                              }|
135      one one one one one                                                        |
136      two  ^here                                                                  |
137      three  three                                                               |
138      {1:~                                                                          }|
139      {3:[No Name] [+]                                                              }|
140      /here                                                                      |
141    ]])
142    feed('a')
143    screen:expect([[
144      one one one one one                                                        |
145      two  here                                                                  |
146      three  three                                                               |
147      Second window                                                              |
148      {1:~                                                                          }|
149      {2:[No Name] [+]                                                              }|
150      one one one one one                                                        |
151      two |hidden| h^ere                                                          |
152      three  three                                                               |
153      {1:~                                                                          }|
154      {3:[No Name] [+]                                                              }|
155      {5:-- INSERT --}                                                               |
156    ]])
157    feed('<Esc>/e')
158    screen:expect([[
159      one one one one one                                                        |
160      two  here                                                                  |
161      three  three                                                               |
162      Second window                                                              |
163      {1:~                                                                          }|
164      {2:[No Name] [+]                                                              }|
165      one one one one one                                                        |
166      two |hidden| h{2:e}re                                                          |
167      three  three                                                               |
168      {1:~                                                                          }|
169      {3:[No Name] [+]                                                              }|
170      /e^                                                                         |
171    ]])
172    feed('<Esc>v')
173    screen:expect([[
174      one one one one one                                                        |
175      two  here                                                                  |
176      three  three                                                               |
177      Second window                                                              |
178      {1:~                                                                          }|
179      {2:[No Name] [+]                                                              }|
180      one one one one one                                                        |
181      two |hidden| {17:^h}ere                                                          |
182      three  three                                                               |
183      {1:~                                                                          }|
184      {3:[No Name] [+]                                                              }|
185      {5:-- VISUAL --}                                                               |
186    ]])
187    feed('<Esc>')
188
189    -- Check that with cursor line is only concealed in Insert mode
190    command('set concealcursor=i')
191    screen:expect([[
192      one one one one one                                                        |
193      two  here                                                                  |
194      three  three                                                               |
195      Second window                                                              |
196      {1:~                                                                          }|
197      {2:[No Name] [+]                                                              }|
198      one one one one one                                                        |
199      two |hidden| ^here                                                          |
200      three  three                                                               |
201      {1:~                                                                          }|
202      {3:[No Name] [+]                                                              }|
203                                                                                 |
204    ]])
205    feed('a')
206    screen:expect([[
207      one one one one one                                                        |
208      two  here                                                                  |
209      three  three                                                               |
210      Second window                                                              |
211      {1:~                                                                          }|
212      {2:[No Name] [+]                                                              }|
213      one one one one one                                                        |
214      two  h^ere                                                                  |
215      three  three                                                               |
216      {1:~                                                                          }|
217      {3:[No Name] [+]                                                              }|
218      {5:-- INSERT --}                                                               |
219    ]])
220    feed('<Esc>/e')
221    screen:expect([[
222      one one one one one                                                        |
223      two  here                                                                  |
224      three  three                                                               |
225      Second window                                                              |
226      {1:~                                                                          }|
227      {2:[No Name] [+]                                                              }|
228      one one one one one                                                        |
229      two |hidden| h{2:e}re                                                          |
230      three  three                                                               |
231      {1:~                                                                          }|
232      {3:[No Name] [+]                                                              }|
233      /e^                                                                         |
234    ]])
235    feed('<Esc>v')
236    screen:expect([[
237      one one one one one                                                        |
238      two  here                                                                  |
239      three  three                                                               |
240      Second window                                                              |
241      {1:~                                                                          }|
242      {2:[No Name] [+]                                                              }|
243      one one one one one                                                        |
244      two |hidden| {17:^h}ere                                                          |
245      three  three                                                               |
246      {1:~                                                                          }|
247      {3:[No Name] [+]                                                              }|
248      {5:-- VISUAL --}                                                               |
249    ]])
250    feed('<Esc>')
251
252    -- Check that with cursor line is only concealed in Visual mode
253    command('set concealcursor=v')
254    screen:expect([[
255      one one one one one                                                        |
256      two  here                                                                  |
257      three  three                                                               |
258      Second window                                                              |
259      {1:~                                                                          }|
260      {2:[No Name] [+]                                                              }|
261      one one one one one                                                        |
262      two |hidden| ^here                                                          |
263      three  three                                                               |
264      {1:~                                                                          }|
265      {3:[No Name] [+]                                                              }|
266                                                                                 |
267    ]])
268    feed('a')
269    screen:expect([[
270      one one one one one                                                        |
271      two  here                                                                  |
272      three  three                                                               |
273      Second window                                                              |
274      {1:~                                                                          }|
275      {2:[No Name] [+]                                                              }|
276      one one one one one                                                        |
277      two |hidden| h^ere                                                          |
278      three  three                                                               |
279      {1:~                                                                          }|
280      {3:[No Name] [+]                                                              }|
281      {5:-- INSERT --}                                                               |
282    ]])
283    feed('<Esc>/e')
284    screen:expect([[
285      one one one one one                                                        |
286      two  here                                                                  |
287      three  three                                                               |
288      Second window                                                              |
289      {1:~                                                                          }|
290      {2:[No Name] [+]                                                              }|
291      one one one one one                                                        |
292      two |hidden| h{2:e}re                                                          |
293      three  three                                                               |
294      {1:~                                                                          }|
295      {3:[No Name] [+]                                                              }|
296      /e^                                                                         |
297    ]])
298    feed('<Esc>v')
299    screen:expect([[
300      one one one one one                                                        |
301      two  here                                                                  |
302      three  three                                                               |
303      Second window                                                              |
304      {1:~                                                                          }|
305      {2:[No Name] [+]                                                              }|
306      one one one one one                                                        |
307      two  {17:^h}ere                                                                  |
308      three  three                                                               |
309      {1:~                                                                          }|
310      {3:[No Name] [+]                                                              }|
311      {5:-- VISUAL --}                                                               |
312    ]])
313    feed('<Esc>')
314
315    -- Check moving the cursor while in insert mode.
316    command('set concealcursor=')
317    feed('a')
318    screen:expect([[
319      one one one one one                                                        |
320      two  here                                                                  |
321      three  three                                                               |
322      Second window                                                              |
323      {1:~                                                                          }|
324      {2:[No Name] [+]                                                              }|
325      one one one one one                                                        |
326      two |hidden| h^ere                                                          |
327      three  three                                                               |
328      {1:~                                                                          }|
329      {3:[No Name] [+]                                                              }|
330      {5:-- INSERT --}                                                               |
331    ]])
332    feed('<Down>')
333    screen:expect([[
334      one one one one one                                                        |
335      two  here                                                                  |
336      three  three                                                               |
337      Second window                                                              |
338      {1:~                                                                          }|
339      {2:[No Name] [+]                                                              }|
340      one one one one one                                                        |
341      two  here                                                                  |
342      three |hidden|^ three                                                       |
343      {1:~                                                                          }|
344      {3:[No Name] [+]                                                              }|
345      {5:-- INSERT --}                                                               |
346    ]])
347    feed('<Esc>')
348
349    -- Check the "o" command
350    screen:expect([[
351      one one one one one                                                        |
352      two  here                                                                  |
353      three  three                                                               |
354      Second window                                                              |
355      {1:~                                                                          }|
356      {2:[No Name] [+]                                                              }|
357      one one one one one                                                        |
358      two  here                                                                  |
359      three |hidden^| three                                                       |
360      {1:~                                                                          }|
361      {3:[No Name] [+]                                                              }|
362                                                                                 |
363    ]])
364    feed('o')
365    screen:expect([[
366      one one one one one                                                        |
367      two  here                                                                  |
368      three  three                                                               |
369      Second window                                                              |
370      {1:~                                                                          }|
371      {2:[No Name] [+]                                                              }|
372      one one one one one                                                        |
373      two  here                                                                  |
374      three  three                                                               |
375      ^                                                                           |
376      {3:[No Name] [+]                                                              }|
377      {5:-- INSERT --}                                                               |
378    ]])
379    feed('<Esc>')
380  end)
381
382  -- oldtest: Test_conceal_with_cursorcolumn()
383  it('CursorColumn and ColorColumn on wrapped line', function()
384    local screen = Screen.new(40, 10)
385    screen:add_extra_attr_ids {
386      [100] = { background = Screen.colors.LightRed },
387    }
388    -- Check that cursorcolumn and colorcolumn don't get broken in presence of
389    -- wrapped lines containing concealed text
390    -- luacheck: push ignore 613 (trailing whitespace in a string)
391    exec([[
392      let lines = ["one one one |hidden| one one one one one one one one",
393            \ "two two two two |hidden| here two two",
394            \ "three |hidden| three three three three three three three three"]
395      call setline(1, lines)
396      set wrap linebreak
397      let &showbreak = ' >>> '
398      syntax match test /|hidden|/ conceal
399      set conceallevel=2
400      set concealcursor=
401      exe "normal /here\r"
402      set cursorcolumn
403      set colorcolumn=50
404    ]])
405    -- luacheck: pop
406
407    screen:expect([[
408      one one one  one one one {21:o}ne            |
409      {1: >>> }one {100:o}ne one one                    |
410      two two two two |hidden| ^here two two   |
411      three  three three three {21:t}hree          |
412      {1: >>> }thre{100:e} three three three            |
413      {1:~                                       }|*4
414      /here                                   |
415    ]])
416
417    -- move cursor to the end of line (the cursor jumps to the next screen line)
418    feed('$')
419    screen:expect([[
420      one one one  one one one one            |
421      {1: >>> }one {100:o}ne one one                    |
422      two two two two |hidden| here two tw^o   |
423      three  three three three three          |
424      {1: >>> }thre{100:e} three three three            |
425      {1:~                                       }|*4
426      /here                                   |
427    ]])
428  end)
429
430  -- oldtest: Test_conceal_wrapped_cursorline_wincolor()
431  it('CursorLine highlight on wrapped lines', function()
432    local screen = Screen.new(40, 4)
433    screen:add_extra_attr_ids {
434      [100] = { background = Screen.colors.WebGreen },
435    }
436    exec([[
437      call setline(1, 'one one one |hidden| one one one one one one one one')
438      syntax match test /|hidden|/ conceal
439      set conceallevel=2 concealcursor=n cursorline
440      normal! g$
441      hi! CursorLine guibg=Green
442    ]])
443    screen:expect([[
444      {100:one one one  one one one one on^e        }|
445      {100: one one one                            }|
446      {1:~                                       }|
447                                              |
448    ]])
449    command('hi! CursorLine guibg=NONE guifg=Red')
450    screen:expect([[
451      {19:one one one  one one one one on^e        }|
452      {19: one one one                            }|
453      {1:~                                       }|
454                                              |
455    ]])
456  end)
457
458  -- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft()
459  it('CursorLine highlight on wrapped lines with rightleft', function()
460    local screen = Screen.new(40, 4)
461    screen:add_extra_attr_ids {
462      [100] = { background = Screen.colors.WebGreen },
463    }
464    exec([[
465      call setline(1, 'one one one |hidden| one one one one one one one one')
466      syntax match test /|hidden|/ conceal
467      set conceallevel=2 concealcursor=n cursorline rightleft
468      normal! g$
469      hi! CursorLine guibg=Green
470    ]])
471    screen:expect([[
472      {100:        ^eno eno eno eno eno  eno eno eno}|
473      {100:                            eno eno eno }|
474      {1:                                       ~}|
475                                              |
476    ]])
477    command('hi! CursorLine guibg=NONE guifg=Red')
478    screen:expect([[
479      {19:        ^eno eno eno eno eno  eno eno eno}|
480      {19:                            eno eno eno }|
481      {1:                                       ~}|
482                                              |
483    ]])
484  end)
485
486  -- oldtest: Test_conceal_resize_term()
487  it('resize editor', function()
488    local screen = Screen.new(75, 6)
489    exec([[
490      call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed')
491      setl cocu=n cole=3
492      syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends
493      normal fb
494    ]])
495    screen:expect([[
496      one two three four five, the ^backticks should be concealed                 |
497      {1:~                                                                          }|*4
498                                                                                 |
499    ]])
500
501    screen:try_resize(75, 7)
502    screen:expect([[
503      one two three four five, the ^backticks should be concealed                 |
504      {1:~                                                                          }|*5
505                                                                                 |
506    ]])
507  end)
508
509  -- oldtest: Test_conceal_linebreak()
510  it('with linebreak', function()
511    local screen = Screen.new(75, 8)
512    exec([[
513      let &wrap = v:true
514      let &conceallevel = 2
515      let &concealcursor = 'nc'
516      let &linebreak = v:true
517      let &showbreak = '+ '
518      let line = 'a`a`a`a`'
519          \ .. 'a'->repeat(&columns - 15)
520          \ .. ' b`b`'
521          \ .. 'b'->repeat(&columns - 10)
522          \ .. ' cccccc'
523      eval ['x'->repeat(&columns), '', line]->setline(1)
524      syntax region CodeSpan matchgroup=Delimiter start=/\z(`\+\)/ end=/\z1/ concealends
525    ]])
526    screen:expect([[
527      ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
528                                                                                 |
529      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa           |
530      {1:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb      |
531      {1:+ }cccccc                                                                   |
532      {1:~                                                                          }|*2
533                                                                                 |
534    ]])
535  end)
536
537  -- Tests for correct display (cursor column position) with +conceal and tabulators.
538  -- oldtest: Test_conceal_cursor_pos()
539  it('cursor and column position with conceal and tabulators', function()
540    exec([[
541      let l = ['start:', '.concealed.     text', "|concealed|\ttext"]
542      let l += ['', "\t.concealed.\ttext", "\t|concealed|\ttext", '']
543      let l += [".a.\t.b.\t.c.\t.d.", "|a|\t|b|\t|c|\t|d|"]
544      call append(0, l)
545      call cursor(1, 1)
546      " Conceal settings.
547      set conceallevel=2
548      set concealcursor=nc
549      syntax match test /|/ conceal
550    ]])
551    feed('ztj')
552    expect_pos(2, 1)
553    -- We should end up in the same column when running these commands on the
554    -- two lines.
555    feed('ft')
556    expect_pos(2, 17)
557    feed('$')
558    expect_pos(2, 20)
559    feed('0j')
560    expect_pos(3, 1)
561    feed('ft')
562    expect_pos(3, 17)
563    feed('$')
564    expect_pos(3, 20)
565    feed('j0j')
566    expect_pos(5, 8)
567    -- Same for next test block.
568    feed('ft')
569    expect_pos(5, 25)
570    feed('$')
571    expect_pos(5, 28)
572    feed('0j')
573    expect_pos(6, 8)
574    feed('ft')
575    expect_pos(6, 25)
576    feed('$')
577    expect_pos(6, 28)
578    feed('0j0j')
579    expect_pos(8, 1)
580    -- And check W with multiple tabs and conceals in a line.
581    feed('W')
582    expect_pos(8, 9)
583    feed('W')
584    expect_pos(8, 17)
585    feed('W')
586    expect_pos(8, 25)
587    feed('$')
588    expect_pos(8, 27)
589    feed('0j')
590    expect_pos(9, 1)
591    feed('W')
592    expect_pos(9, 9)
593    feed('W')
594    expect_pos(9, 17)
595    feed('W')
596    expect_pos(9, 25)
597    feed('$')
598    expect_pos(9, 26)
599    command('set lbr')
600    feed('$')
601    expect_pos(9, 26)
602    command('set list listchars=tab:>-')
603    feed('0')
604    expect_pos(9, 1)
605    feed('W')
606    expect_pos(9, 9)
607    feed('W')
608    expect_pos(9, 17)
609    feed('W')
610    expect_pos(9, 25)
611    feed('$')
612    expect_pos(9, 26)
613  end)
614
615  local function test_conceal_virtualedit_after_eol(wrap)
616    local screen = Screen.new(60, 3)
617    api.nvim_set_option_value('wrap', wrap, {})
618    exec([[
619      call setline(1, 'abcdefgh|hidden|ijklmnpop')
620      syntax match test /|hidden|/ conceal
621      set conceallevel=2 concealcursor=n virtualedit=all
622      normal! $
623    ]])
624    screen:expect([[
625      abcdefghijklmnpo^p                                           |
626      {1:~                                                           }|
627                                                                  |
628    ]])
629    feed('l')
630    screen:expect([[
631      abcdefghijklmnpop^                                           |
632      {1:~                                                           }|
633                                                                  |
634    ]])
635    feed('l')
636    screen:expect([[
637      abcdefghijklmnpop ^                                          |
638      {1:~                                                           }|
639                                                                  |
640    ]])
641    feed('l')
642    screen:expect([[
643      abcdefghijklmnpop  ^                                         |
644      {1:~                                                           }|
645                                                                  |
646    ]])
647    feed('rr')
648    screen:expect([[
649      abcdefghijklmnpop  ^r                                        |
650      {1:~                                                           }|
651                                                                  |
652    ]])
653  end
654
655  -- oldtest: Test_conceal_virtualedit_after_eol()
656  describe('cursor drawn at correct column with virtualedit', function()
657    it('with wrapping', function()
658      test_conceal_virtualedit_after_eol(true)
659    end)
660    it('without wrapping', function()
661      test_conceal_virtualedit_after_eol(false)
662    end)
663  end)
664
665  local function test_conceal_virtualedit_after_eol_rightleft(wrap)
666    local screen = Screen.new(60, 3)
667    api.nvim_set_option_value('wrap', wrap, {})
668    exec([[
669      call setline(1, 'abcdefgh|hidden|ijklmnpop')
670      syntax match test /|hidden|/ conceal
671      set conceallevel=2 concealcursor=n virtualedit=all rightleft
672      normal! $
673    ]])
674    screen:expect([[
675                                                 ^popnmlkjihgfedcba|
676      {1:                                                           ~}|
677                                                                  |
678    ]])
679    feed('h')
680    screen:expect([[
681                                                ^ popnmlkjihgfedcba|
682      {1:                                                           ~}|
683                                                                  |
684    ]])
685    feed('h')
686    screen:expect([[
687                                               ^  popnmlkjihgfedcba|
688      {1:                                                           ~}|
689                                                                  |
690    ]])
691    feed('h')
692    screen:expect([[
693                                              ^   popnmlkjihgfedcba|
694      {1:                                                           ~}|
695                                                                  |
696    ]])
697    feed('rr')
698    screen:expect([[
699                                              ^r  popnmlkjihgfedcba|
700      {1:                                                           ~}|
701                                                                  |
702    ]])
703  end
704
705  -- oldtest: Test_conceal_virtualedit_after_eol_rightleft()
706  describe('cursor drawn correctly with virtualedit and rightleft', function()
707    it('with wrapping', function()
708      test_conceal_virtualedit_after_eol_rightleft(true)
709    end)
710    it('without wrapping', function()
711      test_conceal_virtualedit_after_eol_rightleft(false)
712    end)
713  end)
714
715  local function test_conceal_double_width(wrap)
716    local screen = Screen.new(60, 4)
717    screen:add_extra_attr_ids {
718      [100] = { background = Screen.colors.LightRed },
719    }
720    api.nvim_set_option_value('wrap', wrap, {})
721    exec([[
722      call setline(1, ['aaaaa口=口bbbbb口=口ccccc', 'foobar'])
723      syntax match test /口=口/ conceal cchar=β
724      set conceallevel=2 concealcursor=n colorcolumn=30
725      normal! $
726    ]])
727    screen:expect([[
728      aaaaa{14:β}bbbbb{14:β}cccc^c            {100: }                              |
729      foobar                       {100: }                              |
730      {1:~                                                           }|
731                                                                  |
732    ]])
733    feed('gM')
734    screen:expect([[
735      aaaaa{14:β}bb^bbb{14:β}ccccc            {100: }                              |
736      foobar                       {100: }                              |
737      {1:~                                                           }|
738                                                                  |
739    ]])
740    command('set conceallevel=3')
741    screen:expect([[
742      aaaaabb^bbbccccc              {100: }                              |
743      foobar                       {100: }                              |
744      {1:~                                                           }|
745                                                                  |
746    ]])
747    feed('$')
748    screen:expect([[
749      aaaaabbbbbcccc^c              {100: }                              |
750      foobar                       {100: }                              |
751      {1:~                                                           }|
752                                                                  |
753    ]])
754  end
755
756  -- oldtest: Test_conceal_double_width()
757  describe('cursor drawn correctly when double-width chars are concealed', function()
758    it('with wrapping', function()
759      test_conceal_double_width(true)
760    end)
761    it('without wrapping', function()
762      test_conceal_double_width(false)
763    end)
764  end)
765
766  -- oldtest: Test_conceal_double_width_wrap()
767  it('line wraps correctly when double-width chars are concealed', function()
768    local screen = Screen.new(20, 4)
769    screen:add_extra_attr_ids {
770      [100] = { background = Screen.colors.LightRed },
771    }
772    exec([[
773      call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
774      syntax match test /口=口/ conceal cchar=β
775      set conceallevel=2 concealcursor=n
776      normal! $
777    ]])
778    screen:expect([[
779      aaaaaaaaaa{14:β}bbbbb    |
780      bbbbb{14:β}ccccccccc^c    |
781      {1:~                   }|
782                          |
783    ]])
784    feed('gM')
785    screen:expect([[
786      aaaaaaaaaa{14:β}bbbbb    |
787      ^bbbbb{14:β}cccccccccc    |
788      {1:~                   }|
789                          |
790    ]])
791    command('set conceallevel=3')
792    screen:expect([[
793      aaaaaaaaaabbbbb     |
794      ^bbbbbcccccccccc     |
795      {1:~                   }|
796                          |
797    ]])
798    feed('$')
799    screen:expect([[
800      aaaaaaaaaabbbbb     |
801      bbbbbccccccccc^c     |
802      {1:~                   }|
803                          |
804    ]])
805  end)
806end)