commit 0ed62e84de3f5cb7b3ca7ed084ac0114d6a45d6f
parent 0a31a9aa386a5676286ce9e5ceaa97242a22160a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 12 Feb 2020 11:46:15 +0100
tweaks: weld two fragments together, twice, by eliding an unneeded 'if'
The get_kbinput() routine will never return ERR, so there is no need
to check for that.
Diffstat:
2 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1531,17 +1531,9 @@ void do_input(void)
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (shortcut == NULL) {
- if (input < 0x20 || input > 0xFF || meta_key) {
+ if (input < 0x20 || input > 0xFF || meta_key)
unbound_key(input);
- input = ERR;
- }
- }
-
- /* 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. */
- if (input != ERR && shortcut == NULL) {
- if (ISSET(VIEW_MODE))
+ else if (ISSET(VIEW_MODE))
print_view_warning();
else {
/* Store the byte, and leave room for a terminating zero. */
diff --git a/src/prompt.c b/src/prompt.c
@@ -90,18 +90,11 @@ int do_statusbar_input(bool *finished)
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (shortcut == NULL) {
- if (input < 0x20 || input > 0xFF || meta_key) {
+ if (input < 0x20 || input > 0xFF || meta_key)
beep();
- input = ERR;
- }
- }
-
- /* If the keystroke isn't a shortcut nor a toggle, it's a normal text
- * character: add the it to the input buffer, when allowed. */
- if (input != ERR && shortcut == NULL) {
/* Only accept input when not in restricted mode, or when not at
* the "Write File" prompt, or when there is no filename yet. */
- if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
+ else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
kbinput_len++;
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));