From b49daec3f2b11875c7822008345411e82953cdb7 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 5 Oct 2004 02:46:24 +0000 Subject: [PATCH] in do_insertfile(), if file browsing succeeds, copy the filename we browsed to into ans, put back Enter, and show the prompt one last time so that it's exited properly and the cursor position at the statusbar is reset git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1967 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9719a9a..e9f2531d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -76,6 +76,10 @@ CVS code - - Simplify by reusing variables whereever possible, and add a parameter execute to indicate whether or not to be in "Execute Command" mode. (DLR) + - If file browsing succeeds, copy the filename we browsed to + into ans, put back Enter, and show the prompt one last time so + that it's exited properly and the cursor position at the + statusbar is reset. (DLR) open_prevfile(), open_nextfile() - Translate the "New Buffer" string when displaying "Switched to" messages on the statusbar. (DLR) diff --git a/src/files.c b/src/files.c index d2402913..8b55a639 100644 --- a/src/files.c +++ b/src/files.c @@ -558,10 +558,13 @@ void do_insertfile( if (i == NANO_TOFILES_KEY) { char *tmp = do_browse_from(answer); - if (tmp == NULL) - goto start_again; - free(answer); - answer = tmp; + if (tmp != NULL) { + free(answer); + answer = tmp; + ans = mallocstrcpy(ans, answer); + unget_kbinput(NANO_ENTER_KEY, FALSE); + } + goto start_again; } #endif -- 2.39.5