robin/laufey

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

robinmerge: 1dc9728daa1d8a2702

master
1.9 KiB61 linesraw
1local n = require('test.functional.testnvim')()
2local t = require('test.testutil')
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 feed = n.feed
8local exec = n.exec
9
10before_each(clear)
11
12describe('Visual highlight', function()
13  local screen
14
15  before_each(function()
16    screen = Screen.new(50, 6)
17  end)
18
19  -- oldtest: Test_visual_block_with_virtualedit()
20  it('shows selection correctly with virtualedit=block', function()
21    exec([[
22      call setline(1, ['aaaaaa', 'bbbb', 'cc'])
23      set virtualedit=block
24      normal G
25    ]])
26
27    feed('<C-V>gg$')
28    screen:expect([[
29      {17:aaaaaa^ }                                           |
30      {17:bbbb   }                                           |
31      {17:cc     }                                           |
32      {1:~                                                 }|*2
33      {5:-- VISUAL BLOCK --}                                |
34    ]])
35
36    feed('<Esc>gg<C-V>G$')
37    screen:expect([[
38      {17:aaaaaa }                                           |
39      {17:bbbb   }                                           |
40      {17:cc^     }                                           |
41      {1:~                                                 }|*2
42      {5:-- VISUAL BLOCK --}                                |
43    ]])
44  end)
45
46  -- oldtest: Test_visual_hl_with_showbreak()
47  it("with cursor at end of screen line and 'showbreak'", function()
48    exec([[
49      setlocal showbreak=+
50      call setline(1, repeat('a', &columns + 10))
51      normal g$v4lo
52    ]])
53
54    screen:expect([[
55      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{17:^a}|
56      {1:+}{17:aaaa}aaaaaa                                       |
57      {1:~                                                 }|*3
58      {5:-- VISUAL --}                                      |
59    ]])
60  end)
61end)