From a7e5a5b26ca4b2b4e8d27a15411ea67de66b93f4 Mon Sep 17 00:00:00 2001 From: Samantha Marshall Date: Tue, 10 Jan 2017 10:18:49 -0500 Subject: [PATCH] only prompt the user if they can close all buffers, otherwise it would be misleading --- cmd/micro/actions.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 14669aad..3679ed10 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -1443,21 +1443,24 @@ func (v *View) QuitAll(usePlugin bool) bool { } } - should_quit, _ := messenger.YesNoPrompt("Do you want to quit micro (all open files will be closed)?") - - if should_quit && closeAll { - for _, tab := range tabs { - for _, v := range tab.views { - v.CloseBuffer() + if closeAll { + // only quit if all of the buffers can be closed and the user confirms that they actually want to quit everything + should_quit, _ := messenger.YesNoPrompt("Do you want to quit micro (all open files will be closed)?") + + if should_quit { + for _, tab := range tabs { + for _, v := range tab.views { + v.CloseBuffer() + } } - } - if usePlugin { - PostActionCall("QuitAll", v) - } + if usePlugin { + PostActionCall("QuitAll", v) + } - screen.Fini() - os.Exit(0) + screen.Fini() + os.Exit(0) + } } return false