neovim

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

marks_spec.lua (1127B)


      1 local n = require('test.functional.testnvim')()
      2 
      3 local feed, insert, source = n.feed, n.insert, n.source
      4 local clear, feed_command, expect = n.clear, n.feed_command, n.expect
      5 
      6 describe('marks', function()
      7  before_each(function()
      8    clear()
      9  end)
     10 
     11  -- luacheck: ignore 621 (Indentation)
     12  it('restores a deleted mark after delete-undo-redo-undo', function()
     13    insert([[
     14 
     15      	textline A
     16      	textline B
     17      	textline C
     18 
     19      Results:]])
     20 
     21    feed_command([[:/^\t/+1]])
     22    feed([[maddu<C-R>u]])
     23    source([[
     24      let g:a = string(getpos("'a"))
     25      $put ='Mark after delete-undo-redo-undo: '.g:a
     26    ]])
     27 
     28    expect([=[
     29 
     30      	textline A
     31      	textline B
     32      	textline C
     33 
     34      Results:
     35      Mark after delete-undo-redo-undo: [0, 3, 2, 0]]=])
     36  end)
     37 
     38  it("CTRL-A and CTRL-X updates last changed mark '[, ']", function()
     39    insert([[
     40      CTRL-A CTRL-X:
     41      123 123 123
     42      123 123 123
     43      123 123 123]])
     44 
     45    source([[
     46      /^123/
     47      execute "normal! \<C-A>`[v`]rAjwvjw\<C-X>`[v`]rX"]])
     48 
     49    expect([=[
     50      CTRL-A CTRL-X:
     51      AAA 123 123
     52      123 XXXXXXX
     53      XXX 123 123]=])
     54  end)
     55 end)