aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-05-29 10:39:06 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-05-29 10:39:06 +0200
commit4b7db4f2ca232c630e334fa56b1eb89848d5fcc5 (patch)
tree55608587f33fc1d6f6a8e40dfdf7fea66c750d7a /libbb/lineedit.c
parent171932d7ca62dbb0e0b84a0919e1f3a8a68f03f2 (diff)
downloadbusybox-4b7db4f2ca232c630e334fa56b1eb89848d5fcc5.tar.gz
read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index a0b1bcf8e..81f6fdeff 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1451,10 +1451,13 @@ static int lineedit_read_key(char *read_key_buffer)
pfd.events = POLLIN;
do {
poll_again:
- /* Wait for input. Can't just call read_key, it will return
- * at once if stdin is in non-blocking mode. */
- safe_poll(&pfd, 1, -1);
- /* note: read_key sets errno to 0 on success: */
+ if (read_key_buffer[0] == 0) {
+ /* Wait for input. Can't just call read_key,
+ * it returns at once if stdin
+ * is in non-blocking mode. */
+ safe_poll(&pfd, 1, -1);
+ }
+ /* Note: read_key sets errno to 0 on success: */
ic = read_key(STDIN_FILENO, read_key_buffer);
if (ENABLE_FEATURE_EDITING_ASK_TERMINAL
&& (int32_t)ic == KEYCODE_CURSOR_POS