nano

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

commit 4d4c231dad2bf455aefeb5e20a251bc34326e8d2
parent a195ba6cc014e29d733dc4ec4a863c08fd87576a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  4 Jul 2025 16:45:31 +0200

tweaks: use a direct parameter instead of an intermediary boolean

The intermediary boolean is needed in search_init(), which contains
a loop and several toggles, but it's not needed here.

Diffstat:
Msrc/prototypes.h | 2+-
Msrc/search.c | 10+++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/prototypes.h b/src/prototypes.h @@ -484,7 +484,7 @@ void ask_for_and_do_replacements(void); #if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined (ENABLE_LINTER) || defined (ENABLE_FORMATTER) void goto_line_posx(ssize_t line, size_t pos_x); #endif -void ask_for_line_and_column(bool retain_answer); +void ask_for_line_and_column(char *provided); void goto_line_and_column(ssize_t line, ssize_t column, bool hugfloor); void do_gotolinecolumn(void); #ifndef NANO_TINY diff --git a/src/search.c b/src/search.c @@ -155,7 +155,7 @@ void search_init(bool replacing, bool retain_answer) } else replacing = !replacing; } else if (function == flip_goto) { - ask_for_line_and_column(TRUE); + ask_for_line_and_column(answer); break; } else break; @@ -763,13 +763,13 @@ void goto_line_posx(ssize_t linenumber, size_t pos_x) #endif /* Ask for a line and maybe column number, and then jump there. */ -void ask_for_line_and_column(bool retain_answer) +void ask_for_line_and_column(char *provided) { ssize_t line = openfile->current->lineno; ssize_t column = openfile->placewewant + 1; - int response = do_prompt(MGOTOLINE, retain_answer ? answer : "", NULL, + int response = do_prompt(MGOTOLINE, provided, NULL, edit_refresh, /* TRANSLATORS: This is a prompt. */ - edit_refresh, _("Enter line number, column number")); + _("Enter line number, column number")); int doublesign = 0; /* If the user cancelled or gave a blank answer, get out. */ @@ -879,7 +879,7 @@ void goto_line_and_column(ssize_t line, ssize_t column, bool hugfloor) /* Go to the specified line and column, asking for them beforehand. */ void do_gotolinecolumn(void) { - ask_for_line_and_column(FALSE); + ask_for_line_and_column(""); } #ifndef NANO_TINY