rline: try to fix escape timeouts?

This commit is contained in:
K. Lange 2021-01-01 20:53:24 +09:00
parent b8aecc7a37
commit ac83b77055
1 changed files with 2 additions and 2 deletions

View File

@ -222,11 +222,11 @@ static int getch(int immediate, int timeout) {
_unget = -1;
return out;
}
if (timeout != 1) return fgetc(stdin);
if (immediate) return fgetc(stdin);
struct pollfd fds[1];
fds[0].fd = STDIN_FILENO;
fds[0].events = POLLIN;
int ret = poll(fds,1,(timeout == 1) ? 50 : -1);
int ret = poll(fds,1,10);
if (ret > 0 && fds[0].revents & POLLIN) {
unsigned char buf[1];
int unused = read(STDIN_FILENO, buf, 1);