aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 36dabad804f..3b9447f24b1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6556,6 +6556,11 @@ record_asynch_buffer_change ()
6556 6556
6557#ifndef VMS 6557#ifndef VMS
6558 6558
6559/* This remembers the last number of characters read, so we could
6560 avoid zeroing out the whole struct input_event buf and instead zero
6561 out only its used slots. */
6562static int prev_read = KBD_BUFFER_SIZE;
6563
6559/* Read any terminal input already buffered up by the system 6564/* Read any terminal input already buffered up by the system
6560 into the kbd_buffer, but do not wait. 6565 into the kbd_buffer, but do not wait.
6561 6566
@@ -6576,7 +6581,7 @@ read_avail_input (expected)
6576 register int i; 6581 register int i;
6577 int nread; 6582 int nread;
6578 6583
6579 for (i = 0; i < KBD_BUFFER_SIZE; i++) 6584 for (i = 0; i < prev_read; i++)
6580 EVENT_INIT (buf[i]); 6585 EVENT_INIT (buf[i]);
6581 6586
6582 if (read_socket_hook) 6587 if (read_socket_hook)
@@ -6592,12 +6597,12 @@ read_avail_input (expected)
6592 6597
6593 /* Determine how many characters we should *try* to read. */ 6598 /* Determine how many characters we should *try* to read. */
6594#ifdef WINDOWSNT 6599#ifdef WINDOWSNT
6595 return 0; 6600 return (prev_read = 0);
6596#else /* not WINDOWSNT */ 6601#else /* not WINDOWSNT */
6597#ifdef MSDOS 6602#ifdef MSDOS
6598 n_to_read = dos_keysns (); 6603 n_to_read = dos_keysns ();
6599 if (n_to_read == 0) 6604 if (n_to_read == 0)
6600 return 0; 6605 return (prev_read = 0);
6601#else /* not MSDOS */ 6606#else /* not MSDOS */
6602#ifdef FIONREAD 6607#ifdef FIONREAD
6603 /* Find out how much input is available. */ 6608 /* Find out how much input is available. */
@@ -6615,7 +6620,7 @@ read_avail_input (expected)
6615 n_to_read = 0; 6620 n_to_read = 0;
6616 } 6621 }
6617 if (n_to_read == 0) 6622 if (n_to_read == 0)
6618 return 0; 6623 return (prev_read = 0);
6619 if (n_to_read > sizeof cbuf) 6624 if (n_to_read > sizeof cbuf)
6620 n_to_read = sizeof cbuf; 6625 n_to_read = sizeof cbuf;
6621#else /* no FIONREAD */ 6626#else /* no FIONREAD */
@@ -6706,7 +6711,7 @@ read_avail_input (expected)
6706 break; 6711 break;
6707 } 6712 }
6708 6713
6709 return nread; 6714 return (prev_read = nread);
6710} 6715}
6711#endif /* not VMS */ 6716#endif /* not VMS */
6712 6717