neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

mode_normal_spec.lua (2207B)


      1 -- Normal mode tests.
      2 
      3 local t = require('test.testutil')
      4 local n = require('test.functional.testnvim')()
      5 local Screen = require('test.functional.ui.screen')
      6 
      7 local clear = n.clear
      8 local feed = n.feed
      9 local fn = n.fn
     10 local command = n.command
     11 local eq = t.eq
     12 local api = n.api
     13 
     14 describe('Normal mode', function()
     15  before_each(clear)
     16 
     17  it('setting &winhighlight or &winblend does not change curswant #27470', function()
     18    fn.setline(1, { 'long long lone line', 'short line' })
     19    feed('ggfi')
     20    local pos = fn.getcurpos()
     21    feed('j')
     22    command('setlocal winblend=10 winhighlight=Visual:Search')
     23    feed('k')
     24    eq(pos, fn.getcurpos())
     25  end)
     26 
     27  it('&showcmd does not crash with :startinsert #28419', function()
     28    local screen = Screen.new(60, 17)
     29    fn.jobstart({ n.nvim_prog, '--clean', '--cmd', 'startinsert' }, {
     30      term = true,
     31      env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
     32    })
     33    screen:expect({
     34      grid = [[
     35        ^                                                            |
     36        ~                                                           |*13
     37        [No Name]                                 0,1            All|
     38        -- INSERT --                                                |
     39                                                                    |
     40      ]],
     41      attr_ids = {},
     42    })
     43  end)
     44 
     45  it('replacing with ZWJ emoji sequences', function()
     46    local screen = Screen.new(30, 8)
     47    api.nvim_buf_set_lines(0, 0, -1, true, { 'abcdefg' })
     48    feed('05rπŸ§‘β€πŸŒΎ') -- ZWJ
     49    screen:expect([[
     50      πŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎ^πŸ§‘β€πŸŒΎfg                  |
     51      {1:~                             }|*6
     52                                    |
     53    ]])
     54 
     55    feed('2rπŸ³οΈβ€βš§οΈ') -- ZWJ and variant selectors
     56    screen:expect([[
     57      πŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎπŸ§‘β€πŸŒΎπŸ³οΈβ€βš§οΈ^πŸ³οΈβ€βš§οΈg                 |
     58      {1:~                             }|*6
     59                                    |
     60    ]])
     61  end)
     62 
     63  it('"gk" does not crash with signcolumn=yes in narrow window #31274', function()
     64    feed('o<Esc>')
     65    command('1vsplit | setlocal signcolumn=yes')
     66    feed('gk')
     67    n.assert_alive()
     68  end)
     69 end)