fix: make :restart respect 'confirm' option #36531

When 'confirm' is set and there are unsaved buffers,
:restart now prompts before quitting, matching the behavior of :quit.
This commit is contained in:
alf171
2025-11-16 14:08:38 -05:00
committed by GitHub
parent e4e6605943
commit d464dffd2f
2 changed files with 22 additions and 3 deletions

View File

@@ -378,6 +378,14 @@ describe('TUI :restart', function()
tt.feed_data('C\013')
screen:expect({ any = vim.pesc('[No Name]') })
-- Check :restart respects 'confirm' option.
tt.feed_data(':set confirm\013')
tt.feed_data(':restart\013')
screen:expect({ any = vim.pesc('Save changes to "Untitled"?') })
tt.feed_data('C\013')
screen:expect({ any = vim.pesc('[No Name]') })
tt.feed_data(':set noconfirm\013')
-- Check ":confirm restart <cmd>" on a modified buffer.
tt.feed_data(':confirm restart echo "Hello"\013')
screen:expect({ any = vim.pesc('Save changes to "Untitled"?') })