diff options
author | ZyX <kp-pav@yandex.ru> | 2015-11-01 21:26:53 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-11-23 17:08:01 +0300 |
commit | b98cea909f1a38fc8d0f901164e1e44b03620e2a (patch) | |
tree | fe884161218e72a8e3e8c09979b3482c9bb6d81b /test/functional/shada | |
parent | 321db59ca1dc304feb3e00c10ca3e89c1de616e7 (diff) | |
download | rneovim-b98cea909f1a38fc8d0f901164e1e44b03620e2a.tar.gz rneovim-b98cea909f1a38fc8d0f901164e1e44b03620e2a.tar.bz2 rneovim-b98cea909f1a38fc8d0f901164e1e44b03620e2a.zip |
shada: Also store last search direction
Note: it looks like viminfo files do not store search direction intentionally.
After reading viminfo file search direction was considered to be “forward”.
Note 2: all files created on earlier Neovim version will automatically receive
“forward” direction.
Fixes #3580
Diffstat (limited to 'test/functional/shada')
-rw-r--r-- | test/functional/shada/errors_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/shada/history_spec.lua | 22 |
2 files changed, 25 insertions, 2 deletions
diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index 16ae77af02..62b9e6c84d 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -124,6 +124,11 @@ describe('ShaDa error handling', function() eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sc key value which is not a boolean', exc_exec(sdrcmd())) end) + it('fails on search pattern item with NIL search_backward key value', function() + wshada('\002\000\009\130\162sX\192\162sb\192') + eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sb key value which is not a boolean', exc_exec(sdrcmd())) + end) + it('fails on search pattern item with NIL has_line_offset key value', function() wshada('\002\000\009\130\162sX\192\162sl\192') eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sl key value which is not a boolean', exc_exec(sdrcmd())) diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua index 1123f829d2..94513945d0 100644 --- a/test/functional/shada/history_spec.lua +++ b/test/functional/shada/history_spec.lua @@ -107,14 +107,32 @@ describe('ShaDa support code', function() end) it('dumps and loads last search pattern with offset', function() - funcs.setline('.', {'foo', 'bar'}) + meths.set_option('wrapscan', false) + funcs.setline('.', {'foo', 'bar--'}) nvim_feed('gg0/a/e+1\n') eq({0, 2, 3, 0}, funcs.getpos('.')) nvim_command('wshada') reset() - funcs.setline('.', {'foo', 'bar'}) + meths.set_option('wrapscan', false) + funcs.setline('.', {'foo', 'bar--'}) nvim_feed('gg0n') eq({0, 2, 3, 0}, funcs.getpos('.')) + eq(1, meths.get_vvar('searchforward')) + end) + + it('dumps and loads last search pattern with offset and backward direction', + function() + meths.set_option('wrapscan', false) + funcs.setline('.', {'foo', 'bar--'}) + nvim_feed('G$?a?e+1\n') + eq({0, 2, 3, 0}, funcs.getpos('.')) + nvim_command('wshada') + reset() + meths.set_option('wrapscan', false) + funcs.setline('.', {'foo', 'bar--'}) + nvim_feed('G$n') + eq({0, 2, 3, 0}, funcs.getpos('.')) + eq(0, meths.get_vvar('searchforward')) end) it('saves v:hlsearch=1', function() |