locking: when finding a lock file at startup, quit when user cancels
When at startup the user presses Cancel at the "open anyway?" prompt, cancel the whole startup: quit. But when the user answers No, just skip the file and continue starting up.master
parent
88087f2b2f
commit
7ce1f6d86d
|
@ -335,6 +335,10 @@ int do_lockfile(const char *filename, bool ask_the_user)
|
|||
choice = do_yesno_prompt(FALSE, promptstr);
|
||||
free(promptstr);
|
||||
|
||||
/* When the user cancelled while we're still starting up, quit. */
|
||||
if (choice < 0 && !we_are_running)
|
||||
finish();
|
||||
|
||||
if (choice < 1) {
|
||||
retval = -1;
|
||||
wipe_statusbar();
|
||||
|
|
|
@ -59,6 +59,9 @@ bool started_curses = FALSE;
|
|||
bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for current keystroke? */
|
||||
|
||||
bool we_are_running = FALSE;
|
||||
/* Will become TRUE as soon as all options and files have been read. */
|
||||
|
||||
message_type lastmessage = HUSH;
|
||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||
|
||||
|
|
|
@ -2573,6 +2573,8 @@ int main(int argc, char **argv)
|
|||
statusbar(_("Welcome to nano. For basic help, type Ctrl+G."));
|
||||
#endif
|
||||
|
||||
we_are_running = TRUE;
|
||||
|
||||
while (TRUE) {
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
confirm_margin();
|
||||
|
|
|
@ -43,6 +43,7 @@ extern bool control_C_was_pressed;
|
|||
extern bool suppress_cursorpos;
|
||||
|
||||
extern bool started_curses;
|
||||
extern bool we_are_running;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
|
|
Loading…
Reference in New Issue