nano

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

commit 29986e95a038a29b9cbd0b31befcc3330ad162da
parent 4af1da7d95d64bf85a8b9ee4e1c9c69c62f69e27
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun,  3 Jul 2016 13:37:48 +0200

input: don't drop the first byte when user starts typing during loading

Precalculation of the multiline color data can be cut short when the
user is impatient and starts typing.  But this would drop the first
byte of whatever was typed -- not nice when it was just plain text,
but surprising and worse when the first keystroke was a command.

This fixes https://savannah.gnu.org/bugs/?48388.

Diffstat:
Msrc/color.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/color.c b/src/color.c @@ -401,10 +401,15 @@ void alloc_multidata_if_needed(filestruct *fileptr) bool key_was_pressed(void) { static time_t last_time = 0; + int onebyte; if (time(NULL) != last_time) { last_time = time(NULL); - return (wgetch(edit) != ERR); + onebyte = wgetch(edit); + if (onebyte == ERR) + return FALSE; + ungetch(onebyte); + return TRUE; } else return FALSE; }