diff --git a/input.c b/input.c index 654b94b52..c32cd6fb6 100644 --- a/input.c +++ b/input.c @@ -1675,6 +1675,8 @@ wint_t input_readch() { int i; + + CHECK_BLOCK(); /* Clear the interrupted flag diff --git a/input_common.c b/input_common.c index 03af3a407..a4741bb6e 100644 --- a/input_common.c +++ b/input_common.c @@ -98,6 +98,11 @@ static wint_t readb() { return res; } + if( lookahead_count ) + { + return lookahead_arr[--lookahead_count]; + } + } @@ -107,7 +112,7 @@ static wint_t readb() default: { /* - The teminal has been closed. Save and exit. + The terminal has been closed. Save and exit. */ return R_EOF; } @@ -122,6 +127,11 @@ static wint_t readb() debug( 3, L"Wake up on universal variable event" ); env_universal_read_all(); do_loop = 1; + + if( lookahead_count ) + { + return lookahead_arr[--lookahead_count]; + } } } if( FD_ISSET( 0, &fd ) )