mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 03:41:14 +01:00
Fix: If there was a single tab and a single file was open in split modes, closing a single window closed the entire buffer, so all the windows and neovim closed.
This commit is contained in:
@@ -273,7 +273,7 @@ local function close_window(mode)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Special case: last listed buffer in last window
|
-- Special case: last listed buffer in last window
|
||||||
if total_listed == 1 then
|
if total_listed == 1 and win_count == 1 then
|
||||||
if modified and mode ~= 'save' then
|
if modified and mode ~= 'save' then
|
||||||
-- if buffer had unsaved changes and user chose to discard, force quit
|
-- if buffer had unsaved changes and user chose to discard, force quit
|
||||||
vim.cmd 'qa!'
|
vim.cmd 'qa!'
|
||||||
@@ -284,8 +284,10 @@ local function close_window(mode)
|
|||||||
end
|
end
|
||||||
-- Close logic
|
-- Close logic
|
||||||
if win_count > 1 then
|
if win_count > 1 then
|
||||||
|
-- Buffer is visible in other windows/tabs: just close current window
|
||||||
vim.cmd 'close'
|
vim.cmd 'close'
|
||||||
else
|
else
|
||||||
|
-- Buffer is only open in this window: delete the entire buffer from memory
|
||||||
if modified and mode ~= 'save' then
|
if modified and mode ~= 'save' then
|
||||||
vim.cmd 'bwipeout!' -- discard changes
|
vim.cmd 'bwipeout!' -- discard changes
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user