mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
feat(jumplist): allow opting out of removing unloaded buffers (#30419)
Problem: Cannot opt out of removing unloaded buffers from the jumplist. Solution: Only enable that with "clean" flag in 'jumpoptions'.
This commit is contained in:
@@ -194,7 +194,7 @@ describe("jumpoptions=stack behaves like 'tagstack'", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('buffer deletion', function()
|
||||
describe('buffer deletion with jumpoptions+=clean', function()
|
||||
local base_file = 'Xtest-functional-buffer-deletion'
|
||||
local file1 = base_file .. '1'
|
||||
local file2 = base_file .. '2'
|
||||
@@ -227,6 +227,12 @@ describe('buffer deletion', function()
|
||||
command('edit ' .. file3)
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
os.remove(file1)
|
||||
os.remove(file2)
|
||||
os.remove(file3)
|
||||
end)
|
||||
|
||||
it('deletes jump list entries when the current buffer is deleted', function()
|
||||
command('edit ' .. file1)
|
||||
|
||||
@@ -319,6 +325,44 @@ describe('buffer deletion', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('buffer deletion with jumpoptions-=clean', function()
|
||||
local base_file = 'Xtest-functional-buffer-deletion'
|
||||
local file1 = base_file .. '1'
|
||||
local file2 = base_file .. '2'
|
||||
local base_content = 'text'
|
||||
local content1 = base_content .. '1'
|
||||
local content2 = base_content .. '2'
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
command('clearjumps')
|
||||
command('set jumpoptions-=clean')
|
||||
|
||||
write_file(file1, content1, false, false)
|
||||
write_file(file2, content2, false, false)
|
||||
|
||||
command('edit ' .. file1)
|
||||
command('edit ' .. file2)
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
os.remove(file1)
|
||||
os.remove(file2)
|
||||
end)
|
||||
|
||||
it('Ctrl-O reopens previous buffer with :bunload or :bdelete #28968', function()
|
||||
eq(file2, fn.bufname(''))
|
||||
command('bunload')
|
||||
eq(file1, fn.bufname(''))
|
||||
feed('<C-O>')
|
||||
eq(file2, fn.bufname(''))
|
||||
command('bdelete')
|
||||
eq(file1, fn.bufname(''))
|
||||
feed('<C-O>')
|
||||
eq(file2, fn.bufname(''))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('jumpoptions=view', function()
|
||||
local file1 = 'Xtestfile-functional-editor-jumps'
|
||||
local file2 = 'Xtestfile-functional-editor-jumps-2'
|
||||
|
@@ -13,6 +13,7 @@ if exists('s:did_load')
|
||||
set laststatus=1
|
||||
set listchars=eol:$
|
||||
set joinspaces
|
||||
set jumpoptions=
|
||||
set mousemodel=extend
|
||||
set nohidden nosmarttab noautoindent noautoread noruler noshowcmd
|
||||
set nohlsearch noincsearch
|
||||
|
Reference in New Issue
Block a user