mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
Always asking whether it's okay when the name of the file was changed.
This fixes Savannah bug #46894. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5753 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
036c5f9c1f
commit
4ddf194004
@ -6,6 +6,8 @@
|
|||||||
that is: treat the deletion of words like pressing Backspace/Delete.
|
that is: treat the deletion of words like pressing Backspace/Delete.
|
||||||
* src/search.c (get_history_completion, find_history): Cycle through
|
* src/search.c (get_history_completion, find_history): Cycle through
|
||||||
the items from newest to oldest. This fixes Savannah bug #47205.
|
the items from newest to oldest. This fixes Savannah bug #47205.
|
||||||
|
* src/files.c (do_writeout): When the name of the file was changed,
|
||||||
|
always ask whether this is okay. This fixes Savannah bug #46894.
|
||||||
|
|
||||||
2016-03-19 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-19 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/search.c (search_init): Always remember the last typed string,
|
* src/search.c (search_init): Always remember the last typed string,
|
||||||
|
34
src/files.c
34
src/files.c
@ -2276,6 +2276,8 @@ int do_writeout(bool exiting)
|
|||||||
#ifndef DISABLE_EXTRA
|
#ifndef DISABLE_EXTRA
|
||||||
static bool did_credits = FALSE;
|
static bool did_credits = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
bool maychange = FALSE;
|
||||||
|
/* Whether it's okay to save the file under a different name. */
|
||||||
bool result = FALSE;
|
bool result = FALSE;
|
||||||
|
|
||||||
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
|
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
|
||||||
@ -2452,19 +2454,29 @@ int do_writeout(bool exiting)
|
|||||||
if (ISSET(RESTRICTED))
|
if (ISSET(RESTRICTED))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (name_exists) {
|
if (!maychange) {
|
||||||
i = do_yesno_prompt(FALSE,
|
|
||||||
_("File exists; OVERWRITE? "));
|
|
||||||
if (i == 0 || i == -1)
|
|
||||||
continue;
|
|
||||||
} else
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (exiting || !openfile->mark_set)
|
if (exiting || !openfile->mark_set)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
i = do_yesno_prompt(FALSE,
|
i = do_yesno_prompt(FALSE,
|
||||||
_("Save file under DIFFERENT NAME? "));
|
_("Save file under DIFFERENT NAME? "));
|
||||||
if (i == 0 || i == -1)
|
if (i < 1)
|
||||||
|
continue;
|
||||||
|
maychange = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name_exists) {
|
||||||
|
char *question = _("File \"%s\" exists; OVERWRITE? ");
|
||||||
|
char *message = charalloc(strlen(question) +
|
||||||
|
strlen(answer) + 1);
|
||||||
|
sprintf(message, question, answer);
|
||||||
|
|
||||||
|
i = do_yesno_prompt(FALSE, message);
|
||||||
|
free(message);
|
||||||
|
|
||||||
|
if (i < 1)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user