terminal
terminal copied to clipboard
Move the blocking check to the read method.
Move the stream_get_meta_data check into the read function to always restore the original status.
Also to prevent unnecessary looping/screen flicker, turn blocking off only when there is data in the internal stream buffer.
The __destruct call wasn't always restoring the blocking status in practice, so I've changed the approach, and it should now both fix the pasting issue and leave the blocking status unchanged.
Technically we're not supposed to use unread_bytes to check for more data, but that appears to be exactly what we need to be checking to handle the paste situation. The problem isn't waiting for more data to be read from input, it's forcing the buffered data to be handled without waiting for new input.
Sorry @tbannister I missed this - is it still needed? If so, could you maybe rebase?
Thank you @tbannister That actually solved the bug the I had with the redraw