tweaks: reshuffle some code and drop some comments, for conciseness
Этот коммит содержится в:
родитель
2f25b6a650
Коммит
67750a30ba
31
src/prompt.c
31
src/prompt.c
@ -311,14 +311,10 @@ int do_statusbar_input(void)
|
|||||||
depth = 0;
|
depth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shortcut) {
|
if (!function)
|
||||||
if (function == do_tab || function == do_enter)
|
return input;
|
||||||
return input;
|
|
||||||
#ifdef ENABLE_HISTORIES
|
if (function == do_left)
|
||||||
else if (function == get_older_item || function == get_newer_item)
|
|
||||||
return input;
|
|
||||||
#endif
|
|
||||||
else if (function == do_left)
|
|
||||||
do_statusbar_left();
|
do_statusbar_left();
|
||||||
else if (function == do_right)
|
else if (function == do_right)
|
||||||
do_statusbar_right();
|
do_statusbar_right();
|
||||||
@ -365,9 +361,6 @@ int do_statusbar_input(void)
|
|||||||
#endif
|
#endif
|
||||||
/* Don't handle the handled functions again. */
|
/* Don't handle the handled functions again. */
|
||||||
return ERR;
|
return ERR;
|
||||||
}
|
|
||||||
|
|
||||||
return input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the column number of the first character of the answer that is
|
/* Return the column number of the first character of the answer that is
|
||||||
@ -452,8 +445,6 @@ void add_or_remove_pipe_symbol_from_answer(void)
|
|||||||
functionptrtype acquire_an_answer(int *actual, bool *listed,
|
functionptrtype acquire_an_answer(int *actual, bool *listed,
|
||||||
linestruct **history_list, void (*refresh_func)(void))
|
linestruct **history_list, void (*refresh_func)(void))
|
||||||
{
|
{
|
||||||
int kbinput = ERR;
|
|
||||||
functionptrtype func;
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
char *stored_string = NULL;
|
char *stored_string = NULL;
|
||||||
/* Whatever the answer was before the user foraged into history. */
|
/* Whatever the answer was before the user foraged into history. */
|
||||||
@ -463,7 +454,9 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
size_t fragment_length = 0;
|
size_t fragment_length = 0;
|
||||||
/* The length of the fragment that the user tries to tab complete. */
|
/* The length of the fragment that the user tries to tab complete. */
|
||||||
#endif
|
#endif
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif
|
||||||
|
functionptrtype func;
|
||||||
|
int kbinput = ERR;
|
||||||
|
|
||||||
if (typing_x > strlen(answer))
|
if (typing_x > strlen(answer))
|
||||||
typing_x = strlen(answer);
|
typing_x = strlen(answer);
|
||||||
@ -483,7 +476,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif
|
||||||
|
|
||||||
func = func_from_key(&kbinput);
|
func = func_from_key(&kbinput);
|
||||||
|
|
||||||
@ -508,7 +501,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
if ((currmenu & (MINSERTFILE|MWRITEFILE|MGOTODIR)) && !ISSET(RESTRICTED))
|
if ((currmenu & (MINSERTFILE|MWRITEFILE|MGOTODIR)) && !ISSET(RESTRICTED))
|
||||||
answer = input_tab(answer, &typing_x, refresh_func, listed);
|
answer = input_tab(answer, &typing_x, refresh_func, listed);
|
||||||
} else
|
} else
|
||||||
#endif /* ENABLE_TABCOMP */
|
#endif
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (func == get_older_item && history_list != NULL) {
|
if (func == get_older_item && history_list != NULL) {
|
||||||
/* If this is the first step into history, start at the bottom. */
|
/* If this is the first step into history, start at the bottom. */
|
||||||
@ -540,19 +533,17 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif /* ENABLE_HISTORIES */
|
||||||
/* If we ran a function that should not exit from the prompt... */
|
|
||||||
if (func == do_help || func == full_refresh)
|
if (func == do_help || func == full_refresh)
|
||||||
func();
|
func();
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (func == do_nothing)
|
|
||||||
;
|
|
||||||
else if (func == do_toggle) {
|
else if (func == do_toggle) {
|
||||||
TOGGLE(NO_HELP);
|
TOGGLE(NO_HELP);
|
||||||
window_init();
|
window_init();
|
||||||
focusing = FALSE;
|
focusing = FALSE;
|
||||||
refresh_func();
|
refresh_func();
|
||||||
bottombars(currmenu);
|
bottombars(currmenu);
|
||||||
}
|
} else if (func == do_nothing)
|
||||||
|
;
|
||||||
#endif
|
#endif
|
||||||
else if (func) {
|
else if (func) {
|
||||||
/* When it's a permissible shortcut, run it and done. */
|
/* When it's a permissible shortcut, run it and done. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user