nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit bc91af2e3cb48c4b0e29a4fe3f4a61404ebedc35
parent 48b94d71c778969db243a1318995fc8c4570ea1d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 15 Oct 2019 13:39:03 +0200

tweaks: pass an empty string as an answer instead of a NULL pointer

Also, rename a parameter, to be more distinct and to avoid an abbrev.

Diffstat:
Msrc/browser.c | 4++--
Msrc/prompt.c | 8++++----
Msrc/search.c | 4++--
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/browser.c b/src/browser.c @@ -221,7 +221,7 @@ char *do_browser(char *path) selected = filelist_len - 1; } else if (func == goto_dir_void) { /* Ask for the directory to go to. */ - if (do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL, + if (do_prompt(TRUE, FALSE, MGOTODIR, "", NULL, /* TRANSLATORS: This is a prompt. */ browser_refresh, _("Go To Directory")) < 0) { statusbar(_("Cancelled")); @@ -667,7 +667,7 @@ int filesearch_init(bool forwards) thedefault = copy_of(""); /* Now ask what to search for. */ - response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history, + response = do_prompt(FALSE, FALSE, MWHEREISFILE, "", &search_history, browser_refresh, "%s%s%s", _("Search"), /* TRANSLATORS: A modifier of the Search prompt. */ !forwards ? _(" [Backwards]") : "", thedefault); diff --git a/src/prompt.c b/src/prompt.c @@ -581,10 +581,10 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, * * The allow_tabs parameter indicates whether tab completion is allowed, * and allow_files indicates whether all files (and not just directories) - * can be tab completed. The curranswer parameter is the default answer + * can be tab completed. The 'provided' parameter is the default answer * for when simply Enter is typed. */ int do_prompt(bool allow_tabs, bool allow_files, - int menu, const char *curranswer, linestruct **history_list, + int menu, const char *provided, linestruct **history_list, void (*refresh_func)(void), const char *msg, ...) { va_list ap; @@ -597,8 +597,8 @@ int do_prompt(bool allow_tabs, bool allow_files, bottombars(menu); - if (answer != curranswer || answer == NULL) - answer = mallocstrcpy(answer, curranswer); + if (answer != provided) + answer = mallocstrcpy(answer, provided); #ifndef NANO_TINY redo_theprompt: diff --git a/src/search.c b/src/search.c @@ -699,7 +699,7 @@ void ask_for_replacement(void) linestruct *edittop_save, *begin; size_t firstcolumn_save, begin_x; ssize_t numreplaced; - int response = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, + int response = do_prompt(FALSE, FALSE, MREPLACEWITH, "", /* TRANSLATORS: This is a prompt. */ &replace_history, edit_refresh, _("Replace with")); @@ -758,7 +758,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, if (interactive) { /* Ask for the line and column. */ int response = do_prompt(FALSE, FALSE, MGOTOLINE, - use_answer ? answer : NULL, NULL, edit_refresh, + use_answer ? answer : "", NULL, edit_refresh, /* TRANSLATORS: This is a prompt. */ _("Enter line number, column number"));