summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2018-09-09 20:53:50 -0700
committerJohn Hawthorn <john@hawthorn.email>2018-09-09 21:11:26 -0700
commit7fa5050b40c7dcb6ec3ddd9395cbc694303807fe (patch)
tree64ff84393c9a17b081ed82dc8d0d8452afe1418b /src
parent97ec6364e25070c73bf3331363a30aa61cfd21c9 (diff)
Reduce ambiguous char wait time to 25ms
Diffstat (limited to 'src')
-rw-r--r--src/config.def.h3
-rw-r--r--src/tty.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/config.def.h b/src/config.def.h
index 98cc915..1bc1ad4 100644
--- a/src/config.def.h
+++ b/src/config.def.h
@@ -8,3 +8,6 @@
#define SCORE_MATCH_WORD 0.8
#define SCORE_MATCH_CAPITAL 0.7
#define SCORE_MATCH_DOT 0.6
+
+/* Time (in ms) to wait for additional bytes of an escape sequence */
+#define KEYTIMEOUT 25
diff --git a/src/tty.c b/src/tty.c
index b5b942c..c30100b 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -9,6 +9,8 @@
#include "tty.h"
+#include "../config.h"
+
void tty_reset(tty_t *tty) {
tcsetattr(tty->fdin, TCSANOW, &tty->original_termios);
}
@@ -89,7 +91,7 @@ char tty_getchar(tty_t *tty) {
int tty_input_ready(tty_t *tty, int pending) {
fd_set readfs;
- struct timeval tv = {0, pending ? 500000 : 0};
+ struct timeval tv = {0, pending ? (KEYTIMEOUT * 1000) : 0};
FD_ZERO(&readfs);
FD_SET(tty->fdin, &readfs);
select(tty->fdin + 1, &readfs, NULL, NULL, &tv);