Don't service ioport completions if data is available on stdin

This defers certain autosuggestions and syntax highlighting until after
large pastes are complete.
This commit is contained in:
ridiculousfish 2019-05-13 14:16:43 -07:00
parent 277db64804
commit 0453023f7b

View file

@ -134,13 +134,6 @@ static char_event_t readb() {
}
}
if (ioport > 0 && FD_ISSET(ioport, &fdset)) {
iothread_service_completion();
if (auto mc = s_lookahead->pop_evt()) {
return *mc;
}
}
if (FD_ISSET(STDIN_FILENO, &fdset)) {
unsigned char arr[1];
if (read_blocked(0, arr, 1) != 1) {
@ -151,6 +144,15 @@ static char_event_t readb() {
// We read from stdin, so don't loop.
return arr[0];
}
// Check for iothread completions only if there is no data to be read from the stdin.
// This gives priority to the foreground.
if (ioport > 0 && FD_ISSET(ioport, &fdset)) {
iothread_service_completion();
if (auto mc = s_lookahead->pop_evt()) {
return *mc;
}
}
}
}
}