Displaying "No file name" on the statusbar for two seconds

when --tempfile was given and the current buffer has no name.
This fixes Savannah bug #41750.  Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4974 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-06-16 20:44:34 +00:00
parent 7152a4b544
commit 4f3f976030
3 changed files with 32 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2014-06-16 David Lawrence Ramsey <pooka109@gmail.com>
* src/nano.c (do_exit): Display the message "No file name" on the
statusbar for two seconds when --tempfile was given and the current
buffer has no name. This fixes Savannah bug #41750.
2014-06-16 Benno Schulenberg <bensberg@justemail.net> 2014-06-16 Benno Schulenberg <bensberg@justemail.net>
* configure.ac: For the sake of statically linked systems, make sure * configure.ac: For the sake of statically linked systems, make sure
the compiler also links against libz, which is used by libmagic. the compiler also links against libz, which is used by libmagic.

View File

@ -2208,7 +2208,8 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
/* Write the current file to disk. If the mark is on, write the current /* Write the current file to disk. If the mark is on, write the current
* marked selection to disk. If exiting is TRUE, write the file to disk * marked selection to disk. If exiting is TRUE, write the file to disk
* regardless of whether the mark is on, and without prompting if the * regardless of whether the mark is on, and without prompting if the
* TEMP_FILE flag is set. Return TRUE on success or FALSE on error. */ * TEMP_FILE flag is set and the current file has a name. Return TRUE
* on success or FALSE on error. */
bool do_writeout(bool exiting) bool do_writeout(bool exiting)
{ {
int i; int i;

View File

@ -1086,9 +1086,10 @@ void nano_disabled_msg(void)
/* If the current file buffer has been modified, and the TEMP_FILE flag /* If the current file buffer has been modified, and the TEMP_FILE flag
* isn't set, ask whether or not to save the file buffer. If the * isn't set, ask whether or not to save the file buffer. If the
* TEMP_FILE flag is set, save it unconditionally. Then, if more than * TEMP_FILE flag is set and the current file has a name, save it
* one file buffer is open, close the current file buffer and switch to * unconditionally. Then, if more than one file buffer is open, close
* the next one. If only one file buffer is open, exit from nano. */ * the current file buffer and switch to the next one. If only one file
* buffer is open, exit from nano. */
void do_exit(void) void do_exit(void)
{ {
int i; int i;
@ -1097,13 +1098,31 @@ void do_exit(void)
* save. */ * save. */
if (!openfile->modified) if (!openfile->modified)
i = 0; i = 0;
/* If the TEMP_FILE flag is set, pretend the user chose to save. */ /* If the TEMP_FILE flag is set and the current file has a name,
else if (ISSET(TEMP_FILE)) * pretend the user chose to save. */
else if (openfile->filename[0] != '\0' && ISSET(TEMP_FILE))
i = 1; i = 1;
/* Otherwise, ask the user whether or not to save. */ /* Otherwise, ask the user whether or not to save. */
else else {
/* If the TEMP_FILE flag is set, and the current file doesn't
* have a name, handle it the same way Pico does. */
if (ISSET(TEMP_FILE)) {
curs_set(0);
/* Warn that the current file has no name. */
statusbar(_("No file name"));
beep();
/* Ensure that we see the warning. */
doupdate();
napms(2000);
curs_set(1);
}
i = do_yesno_prompt(FALSE, i = do_yesno_prompt(FALSE,
_("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ")); _("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
}
#ifdef DEBUG #ifdef DEBUG
dump_filestruct(openfile->fileage); dump_filestruct(openfile->fileage);