mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 21:01:24 +03:00
tweaks: get rid of some cluttering conditional compilation
In the tiny version, do_prompt() will now have an extra NULL parameter, which will cost maybe twenty extra bytes of code. That is acceptable when it saves thirty lines in the source.
This commit is contained in:
parent
ab6e4e36e2
commit
3f27c312c4
@ -225,10 +225,7 @@ char *do_browser(char *path)
|
||||
selected = filelist_len - 1;
|
||||
} else if (func == goto_dir_void) {
|
||||
/* Ask for the directory to go to. */
|
||||
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
browser_refresh, _("Go To Directory"));
|
||||
|
||||
@ -679,10 +676,7 @@ int filesearch_init(void)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
browser_refresh, "%s%s", _("Search"), buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
|
10
src/files.c
10
src/files.c
@ -1065,13 +1065,10 @@ void do_insertfile(void)
|
||||
execute ? MEXTCMD :
|
||||
#endif
|
||||
MINSERTFILE, given,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
#ifndef NANO_TINY
|
||||
execute ? &execute_history :
|
||||
#endif
|
||||
NULL,
|
||||
#endif
|
||||
edit_refresh, msg,
|
||||
NULL, edit_refresh, msg,
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
operating_dir != NULL ? operating_dir :
|
||||
#endif
|
||||
@ -2082,10 +2079,7 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
/* Ask for (confirmation of) the filename. Disable tab completion
|
||||
* when using restricted mode and the filename isn't blank. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
|
||||
TRUE, MWRITEFILE, given,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
TRUE, MWRITEFILE, given, NULL,
|
||||
edit_refresh, "%s%s%s", msg,
|
||||
#ifndef NANO_TINY
|
||||
formatstr, backupstr
|
||||
|
10
src/global.c
10
src/global.c
@ -203,21 +203,21 @@ subnfunc *exitfunc;
|
||||
subnfunc *uncutfunc;
|
||||
/* A pointer to the special Uncut/Unjustify item. */
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct *search_history = NULL;
|
||||
/* The current item in the list of strings that were searched for. */
|
||||
filestruct *execute_history = NULL;
|
||||
/* The current item in the list of commands that were run with ^R ^X. */
|
||||
filestruct *replace_history = NULL;
|
||||
/* The current item in the list of replace strings. */
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct *searchtop = NULL;
|
||||
/* The oldest item in the list of search strings. */
|
||||
filestruct *searchbot = NULL;
|
||||
/* The newest item in the list of search strings. */
|
||||
|
||||
filestruct *replace_history = NULL;
|
||||
/* The current item in the list of replace strings. */
|
||||
filestruct *replacetop = NULL;
|
||||
filestruct *replacebot = NULL;
|
||||
|
||||
filestruct *execute_history = NULL;
|
||||
/* The current item in the list of commands that were run with ^R ^X. */
|
||||
filestruct *executetop = NULL;
|
||||
filestruct *executebot = NULL;
|
||||
|
||||
|
@ -607,10 +607,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
* interpreted. The allow_files parameter indicates whether we should
|
||||
* allow all files (as opposed to just directories) to be tab completed. */
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
int menu, const char *curranswer, filestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
11
src/proto.h
11
src/proto.h
@ -158,14 +158,14 @@ extern subnfunc *allfuncs;
|
||||
extern subnfunc *exitfunc;
|
||||
extern subnfunc *uncutfunc;
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *execute_history;
|
||||
#ifndef DISABLE_HISTORIES
|
||||
extern filestruct *searchtop;
|
||||
extern filestruct *searchbot;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *replacetop;
|
||||
extern filestruct *replacebot;
|
||||
extern filestruct *execute_history;
|
||||
extern filestruct *executetop;
|
||||
extern filestruct *executebot;
|
||||
extern poshiststruct *position_history;
|
||||
@ -477,10 +477,7 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reinit_statusbar_x(void);
|
||||
void update_the_statusbar(void);
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
int menu, const char *curranswer, filestruct **history_list,
|
||||
void (*refresh_func)(void), const char *msg, ...);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
|
15
src/search.c
15
src/search.c
@ -131,10 +131,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE, FALSE,
|
||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||
backupstring,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
backupstring, &search_history,
|
||||
/* TRANSLATORS: This is the main search prompt. */
|
||||
edit_refresh, "%s%s%s%s%s%s", _("Search"),
|
||||
/* TRANSLATORS: The next three modify the search prompt. */
|
||||
@ -747,10 +744,7 @@ void do_replace(void)
|
||||
if (i != 0)
|
||||
return;
|
||||
|
||||
i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&replace_history,
|
||||
#endif
|
||||
i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
@ -815,10 +809,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
use_answer ? answer : NULL, NULL,
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
edit_refresh, _("Enter line number, column number"));
|
||||
|
||||
|
@ -2636,10 +2636,7 @@ bool do_int_spell_fix(const char *word)
|
||||
spotlight(TRUE, from_col, to_col);
|
||||
|
||||
/* Let the user supply a correctly spelled alternative. */
|
||||
proceed = (do_prompt(FALSE, FALSE, MSPELL, word,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
proceed = (do_prompt(FALSE, FALSE, MSPELL, word, NULL,
|
||||
edit_refresh, _("Edit a replacement")) != -1);
|
||||
|
||||
spotlight(FALSE, from_col, to_col);
|
||||
|
Loading…
Reference in New Issue
Block a user