diff --git a/src/nano.c b/src/nano.c index 27762a94..0fb894bd 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1379,9 +1379,8 @@ bool wanted_to_move(void (*func)(void)) /* Return TRUE when the given function makes a change -- no good for view mode. */ bool changes_something(const void *f) { - return (f == do_savefile || f == do_writeout || f == do_enter || - f == do_tab || f == do_delete || f == do_backspace || - f == cut_text || f == paste_text || f == do_replace || + return (f == do_savefile || f == do_writeout || f == do_enter || f == do_tab || + f == do_delete || f == do_backspace || f == cut_text || f == paste_text || #ifndef NANO_TINY f == chop_previous_word || f == chop_next_word || f == zap_text || f == cut_till_eof || f == do_execute || @@ -1399,7 +1398,7 @@ bool changes_something(const void *f) #ifdef ENABLE_WORDCOMPLETION f == complete_a_word || #endif - f == do_verbatim_input); + f == do_replace || f == do_verbatim_input); } #ifndef NANO_TINY diff --git a/src/prompt.c b/src/prompt.c index 4a828638..f99bec25 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -442,7 +442,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed, #ifndef NANO_TINY /* If the window size changed, go reformat the prompt string. */ if (input == KEY_WINCH) { - refresh_func(); + refresh_func(); /* Only needed when in file browser. */ *actual = KEY_WINCH; #ifdef ENABLE_HISTORIES free(stored_string); @@ -595,20 +595,18 @@ int do_prompt(int menu, const char *provided, linestruct **history_list, function = acquire_an_answer(&retval, &listed, history_list, refresh_func); free(prompt); - prompt = saved_prompt; #ifndef NANO_TINY if (retval == KEY_WINCH) goto redo_theprompt; #endif - /* If we're done with this prompt, restore the x position to what - * it was at a possible previous prompt. */ + /* Restore a possible previous prompt and maybe the typing position. */ + prompt = saved_prompt; if (function == do_cancel || function == do_enter) typing_x = was_typing_x; - /* If we left the prompt via Cancel or Enter, set the return value - * properly. */ + /* Set the proper return value for Cancel and Enter. */ if (function == do_cancel) retval = -1; else if (function == do_enter)