tweaks: rewrap some lines, drop a redundant call, and reshuffle a line
Six years ago, commit a878f5f1 introduced a call of regenerate_screen() directly in the input routine, which made the call of refresh_func() in the prompt routine redundant -- except when in the file browser.
This commit is contained in:
parent
d0dc270eec
commit
7bab8780ad
@ -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. */
|
/* Return TRUE when the given function makes a change -- no good for view mode. */
|
||||||
bool changes_something(const void *f)
|
bool changes_something(const void *f)
|
||||||
{
|
{
|
||||||
return (f == do_savefile || f == do_writeout || f == do_enter ||
|
return (f == do_savefile || f == do_writeout || f == do_enter || f == do_tab ||
|
||||||
f == do_tab || f == do_delete || f == do_backspace ||
|
f == do_delete || f == do_backspace || f == cut_text || f == paste_text ||
|
||||||
f == cut_text || f == paste_text || f == do_replace ||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
f == chop_previous_word || f == chop_next_word ||
|
f == chop_previous_word || f == chop_next_word ||
|
||||||
f == zap_text || f == cut_till_eof || f == do_execute ||
|
f == zap_text || f == cut_till_eof || f == do_execute ||
|
||||||
@ -1399,7 +1398,7 @@ bool changes_something(const void *f)
|
|||||||
#ifdef ENABLE_WORDCOMPLETION
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
f == complete_a_word ||
|
f == complete_a_word ||
|
||||||
#endif
|
#endif
|
||||||
f == do_verbatim_input);
|
f == do_replace || f == do_verbatim_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
|||||||
10
src/prompt.c
10
src/prompt.c
@ -442,7 +442,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If the window size changed, go reformat the prompt string. */
|
/* If the window size changed, go reformat the prompt string. */
|
||||||
if (input == KEY_WINCH) {
|
if (input == KEY_WINCH) {
|
||||||
refresh_func();
|
refresh_func(); /* Only needed when in file browser. */
|
||||||
*actual = KEY_WINCH;
|
*actual = KEY_WINCH;
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
free(stored_string);
|
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);
|
function = acquire_an_answer(&retval, &listed, history_list, refresh_func);
|
||||||
free(prompt);
|
free(prompt);
|
||||||
prompt = saved_prompt;
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (retval == KEY_WINCH)
|
if (retval == KEY_WINCH)
|
||||||
goto redo_theprompt;
|
goto redo_theprompt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we're done with this prompt, restore the x position to what
|
/* Restore a possible previous prompt and maybe the typing position. */
|
||||||
* it was at a possible previous prompt. */
|
prompt = saved_prompt;
|
||||||
if (function == do_cancel || function == do_enter)
|
if (function == do_cancel || function == do_enter)
|
||||||
typing_x = was_typing_x;
|
typing_x = was_typing_x;
|
||||||
|
|
||||||
/* If we left the prompt via Cancel or Enter, set the return value
|
/* Set the proper return value for Cancel and Enter. */
|
||||||
* properly. */
|
|
||||||
if (function == do_cancel)
|
if (function == do_cancel)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
else if (function == do_enter)
|
else if (function == do_enter)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user