marks_spec.lua 1.1 KB

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