From afab65e8a838a0fb19522f334c847afc4cc0812f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 30 Dec 2018 12:45:52 +0100 Subject: [PATCH] tweaks: elide a parameter that is always TRUE The parameter was made redundant by David's overhaul of the justification code. --- src/nano.c | 22 ++++++++-------------- src/proto.h | 1 - 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/nano.c b/src/nano.c index 0ae56413..6eb3f2ac 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1652,9 +1652,8 @@ bool okay_for_view(const sc *shortcut) } /* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle; - * otherwise, insert it into the edit buffer. If allow_funcs is FALSE, don't - * do anything with the keystroke -- just return it. */ -int do_input(bool allow_funcs) + * otherwise, insert it into the edit buffer. */ +void do_input(void) { int input; /* The keystroke we read in: a character or a shortcut. */ @@ -1671,7 +1670,7 @@ int do_input(bool allow_funcs) #ifndef NANO_TINY if (input == KEY_WINCH) - return KEY_WINCH; + return; #endif #ifdef ENABLE_MOUSE @@ -1683,7 +1682,7 @@ int do_input(bool allow_funcs) input = get_kbinput(edit, BLIND); else /* The click was invalid or has been handled -- get out. */ - return ERR; + return; } #endif @@ -1699,9 +1698,6 @@ int do_input(bool allow_funcs) } } - if (!allow_funcs) - return input; - /* If the keystroke isn't a shortcut nor a toggle, it's a normal text * character: add the character to the input buffer -- or display a * warning when we're in view mode. */ @@ -1744,7 +1740,7 @@ int do_input(bool allow_funcs) else { if (ISSET(VIEW_MODE) && !okay_for_view(shortcut)) { print_view_warning(); - return ERR; + return; } /* If the function associated with this shortcut is @@ -1763,7 +1759,7 @@ int do_input(bool allow_funcs) #ifdef ENABLE_NANORC if (shortcut->func == (functionptrtype)implant) { implant(shortcut->expansion); - return 42; + return; } #endif #ifndef NANO_TINY @@ -1828,8 +1824,6 @@ int do_input(bool allow_funcs) * blow away the text in the cutbuffer upon the next cutting action. */ if (!retain_cuts) cutbuffer_reset(); - - return input; } /* The user typed output_len multibyte characters. Add them to the edit @@ -2707,7 +2701,7 @@ int main(int argc, char **argv) /* Forget any earlier cursor position at the prompt. */ put_cursor_at_end_of_answer(); - /* Read in and interpret keystrokes. */ - do_input(TRUE); + /* Read in and interpret a single keystroke. */ + do_input(); } } diff --git a/src/proto.h b/src/proto.h index 623b81f7..c3db00ff 100644 --- a/src/proto.h +++ b/src/proto.h @@ -430,7 +430,6 @@ void confirm_margin(void); #endif void unbound_key(int code); bool okay_for_view(const sc *shortcut); -int do_input(bool allow_funcs); void do_output(char *output, size_t output_len, bool allow_cntrls); /* Most functions in prompt.c. */