From 0d0d01157913feb6782cdde6fa76c9803d985330 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 12 Feb 2020 12:09:12 +0100 Subject: [PATCH] tweaks: combine two ifs into one --- src/nano.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/nano.c b/src/nano.c index 599e6cc0..b9b10b55 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1549,16 +1549,14 @@ void do_input(void) /* If we have a command, or if there aren't any other key codes waiting, * it's time to insert the gathered bytes into the current buffer. */ - if (shortcut || get_key_buffer_len() == 0) { - if (puddle != NULL) { - puddle[depth] = '\0'; - inject(puddle, depth); + if ((shortcut || get_key_buffer_len() == 0) && puddle != NULL) { + puddle[depth] = '\0'; - /* Empty the little input buffer. */ - free(puddle); - puddle = NULL; - depth = 0; - } + inject(puddle, depth); + + free(puddle); + puddle = NULL; + depth = 0; } if (shortcut == NULL) {