Commit 29986e95 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
parent 4af1da7d
Showing with 6 additions and 1 deletion
+6 -1
...@@ -401,10 +401,15 @@ void alloc_multidata_if_needed(filestruct *fileptr) ...@@ -401,10 +401,15 @@ void alloc_multidata_if_needed(filestruct *fileptr)
bool key_was_pressed(void) bool key_was_pressed(void)
{ {
static time_t last_time = 0; static time_t last_time = 0;
int onebyte;
if (time(NULL) != last_time) { if (time(NULL) != last_time) {
last_time = time(NULL); last_time = time(NULL);
return (wgetch(edit) != ERR); onebyte = wgetch(edit);
if (onebyte == ERR)
return FALSE;
ungetch(onebyte);
return TRUE;
} else } else
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment