marks_spec.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local feed, insert, source = helpers.feed, helpers.insert, helpers.source
  3. local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.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)