mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 03:30:37 +00:00
shada: Use same merging code for jumps and changes
This commit is contained in:
@@ -118,28 +118,14 @@ describe('ShaDa support code', function()
|
||||
nvim_command('edit ' .. testfilename)
|
||||
nvim_feed('G')
|
||||
nvim_feed('gg')
|
||||
-- nvim_command('redir! >/tmp/jumps.last | jumps | redir END')
|
||||
-- nvim_command('wshada /tmp/foo')
|
||||
nvim_command('enew')
|
||||
nvim_feed('gg')
|
||||
nvim_command('redir => g:jumps | jumps | redir END')
|
||||
local saved = nvim_eval('g:jumps')
|
||||
nvim_command('qall')
|
||||
reset()
|
||||
nvim_command('redraw')
|
||||
-- nvim_command('redir! >/tmp/jumps.init | jumps | redir END')
|
||||
nvim_command('edit ' .. testfilename)
|
||||
-- nvim_command('redir! >/tmp/jumps | jumps | redir END')
|
||||
eq(testfilename, nvim_eval('bufname("%")'))
|
||||
eq(1, nvim_current_line())
|
||||
nvim_command('execute "normal! \\<C-o>"')
|
||||
eq(testfilename, nvim_eval('bufname("%")'))
|
||||
eq(1, nvim_current_line())
|
||||
nvim_command('execute "normal! \\<C-o>"')
|
||||
eq(testfilename, nvim_eval('bufname("%")'))
|
||||
eq(2, nvim_current_line())
|
||||
nvim_command('execute "normal! \\<C-o>"')
|
||||
eq(testfilename_2, nvim_eval('bufname("%")'))
|
||||
eq(1, nvim_current_line())
|
||||
nvim_command('execute "normal! \\<C-o>"')
|
||||
eq(testfilename_2, nvim_eval('bufname("%")'))
|
||||
eq(2, nvim_current_line())
|
||||
nvim_command('redir => g:jumps | jumps | redir END')
|
||||
eq(saved, nvim_eval('g:jumps'))
|
||||
end)
|
||||
|
||||
it('is able to dump and restore jump list with different times (slow!)',
|
||||
|
||||
@@ -772,12 +772,13 @@ describe('ShaDa jumps support code', function()
|
||||
eq('', nvim_eval('bufname("%")'))
|
||||
eq('\n'
|
||||
.. ' jump line col file/text\n'
|
||||
.. ' 5 2 0 /a/b/c\n'
|
||||
.. ' 6 2 0 /a/b/c\n'
|
||||
.. ' 5 2 0 /a/b/d\n'
|
||||
.. ' 4 3 0 /a/b/d\n'
|
||||
.. ' 3 2 0 /a/b/d\n'
|
||||
.. ' 3 2 0 /a/b/e\n'
|
||||
.. ' 2 2 0 /a/b/f\n'
|
||||
.. ' 1 2 0 /a/b/e\n'
|
||||
.. '> 0 1 0 ', nvim_eval('g:jumps'))
|
||||
.. ' 1 1 0 \n'
|
||||
.. '>', nvim_eval('g:jumps'))
|
||||
end)
|
||||
|
||||
it('merges jumps when writing', function()
|
||||
@@ -791,10 +792,10 @@ describe('ShaDa jumps support code', function()
|
||||
eq(0, exc_exec('wshada ' .. shada_fname))
|
||||
local jumps = {
|
||||
{file='/a/b/c', line=2},
|
||||
{file='/a/b/d', line=3},
|
||||
{file='/a/b/d', line=2},
|
||||
{file='/a/b/f', line=2},
|
||||
{file='/a/b/d', line=3},
|
||||
{file='/a/b/e', line=2},
|
||||
{file='/a/b/f', line=2},
|
||||
}
|
||||
local found = 0
|
||||
for _, v in ipairs(read_shada_file(shada_fname)) do
|
||||
|
||||
Reference in New Issue
Block a user