mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
vim-patch:8.2.0004: get E685 and E931 if buffer reload is interrupted
Problem: Get E685 and E931 if buffer reload is interrupted.
Solution: Do not abort deleting a dummy buffer. (closes vim/vim#5361)
a6e8f888e7
This commit is contained in:
@@ -17,8 +17,8 @@ describe('buffer functions', function()
|
||||
return buffer.buflist_new(c_file, c_file, 1, flags)
|
||||
end
|
||||
|
||||
local close_buffer = function(win, buf, action, abort_if_last)
|
||||
return buffer.close_buffer(win, buf, action, abort_if_last)
|
||||
local close_buffer = function(win, buf, action, abort_if_last, ignore_abort)
|
||||
return buffer.close_buffer(win, buf, action, abort_if_last, ignore_abort)
|
||||
end
|
||||
|
||||
local path1 = 'test_file_path'
|
||||
@@ -53,7 +53,7 @@ describe('buffer functions', function()
|
||||
itp('should view a closed and hidden buffer as valid', function()
|
||||
local buf = buflist_new(path1, buffer.BLN_LISTED)
|
||||
|
||||
close_buffer(NULL, buf, 0, 0)
|
||||
close_buffer(NULL, buf, 0, 0, 0)
|
||||
|
||||
eq(true, buffer.buf_valid(buf))
|
||||
end)
|
||||
@@ -61,7 +61,7 @@ describe('buffer functions', function()
|
||||
itp('should view a closed and unloaded buffer as valid', function()
|
||||
local buf = buflist_new(path1, buffer.BLN_LISTED)
|
||||
|
||||
close_buffer(NULL, buf, buffer.DOBUF_UNLOAD, 0)
|
||||
close_buffer(NULL, buf, buffer.DOBUF_UNLOAD, 0, 0)
|
||||
|
||||
eq(true, buffer.buf_valid(buf))
|
||||
end)
|
||||
@@ -69,7 +69,7 @@ describe('buffer functions', function()
|
||||
itp('should view a closed and wiped buffer as invalid', function()
|
||||
local buf = buflist_new(path1, buffer.BLN_LISTED)
|
||||
|
||||
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0, 0)
|
||||
|
||||
eq(false, buffer.buf_valid(buf))
|
||||
end)
|
||||
@@ -90,7 +90,7 @@ describe('buffer functions', function()
|
||||
|
||||
eq(buf.handle, buflist_findpat(path1, ONLY_LISTED))
|
||||
|
||||
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0, 0)
|
||||
end)
|
||||
|
||||
itp('should prefer to match the start of a file path', function()
|
||||
@@ -102,9 +102,9 @@ describe('buffer functions', function()
|
||||
eq(buf2.handle, buflist_findpat("file", ONLY_LISTED))
|
||||
eq(buf3.handle, buflist_findpat("path", ONLY_LISTED))
|
||||
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0, 0)
|
||||
end)
|
||||
|
||||
itp('should prefer to match the end of a file over the middle', function()
|
||||
@@ -118,7 +118,7 @@ describe('buffer functions', function()
|
||||
--}
|
||||
|
||||
--{ When: We close buf2
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0, 0)
|
||||
|
||||
-- And: Open buf1, which has 'file' in the middle of its name
|
||||
local buf1 = buflist_new(path1, buffer.BLN_LISTED)
|
||||
@@ -127,8 +127,8 @@ describe('buffer functions', function()
|
||||
eq(buf3.handle, buflist_findpat("file", ONLY_LISTED))
|
||||
--}
|
||||
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0, 0)
|
||||
end)
|
||||
|
||||
itp('should match a unique fragment of a file path', function()
|
||||
@@ -138,9 +138,9 @@ describe('buffer functions', function()
|
||||
|
||||
eq(buf3.handle, buflist_findpat("_test_", ONLY_LISTED))
|
||||
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0, 0)
|
||||
end)
|
||||
|
||||
itp('should include / ignore unlisted buffers based on the flag.', function()
|
||||
@@ -152,7 +152,7 @@ describe('buffer functions', function()
|
||||
--}
|
||||
|
||||
--{ When: We unlist the buffer
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_DEL, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_DEL, 0, 0)
|
||||
|
||||
-- Then: It should not find the buffer when searching only listed buffers
|
||||
eq(-1, buflist_findpat("_test_", ONLY_LISTED))
|
||||
@@ -162,7 +162,7 @@ describe('buffer functions', function()
|
||||
--}
|
||||
|
||||
--{ When: We wipe the buffer
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0, 0)
|
||||
|
||||
-- Then: It should not find the buffer at all
|
||||
eq(-1, buflist_findpat("_test_", ONLY_LISTED))
|
||||
@@ -180,7 +180,7 @@ describe('buffer functions', function()
|
||||
--}
|
||||
|
||||
--{ When: The first buffer is unlisted
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_DEL, 0)
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_DEL, 0, 0)
|
||||
|
||||
-- Then: The second buffer is preferred because
|
||||
-- unlisted buffers are not allowed
|
||||
@@ -194,7 +194,7 @@ describe('buffer functions', function()
|
||||
--}
|
||||
|
||||
--{ When: We unlist the second buffer
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_DEL, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_DEL, 0, 0)
|
||||
|
||||
-- Then: The first buffer is preferred again
|
||||
-- because buf1 matches better which takes precedence
|
||||
@@ -205,8 +205,8 @@ describe('buffer functions', function()
|
||||
eq(-1, buflist_findpat("test", ONLY_LISTED))
|
||||
--}
|
||||
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0)
|
||||
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0, 0)
|
||||
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0, 0)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user