On Unix with the default (mio) event source, a paste larger than a few KB stops partway and only continues one 1024-byte chunk per later keypress.
UnixInternalEventSource::try_read reads one TTY_BUFFER_SIZE chunk, feeds it to the parser, and returns as soon as the parser yields the first event:
https://github.com/crossterm-rs/crossterm/blob/101fa5da/src/event/source/unix/mio.rs#L94-L123
The tty fd is registered with mio, which is edge-triggered. Once the queued events have been consumed, the next try_read polls again, but the bytes still sitting in the fd raise no new readiness event, so the poll times out and those bytes stay unread until new input arrives.
Repro: the paste_burst example in reedline (nushell/reedline#1132). Pasting 500 lines (8392 bytes) stops at exactly 5120 bytes, and every keypress after that releases exactly 1024 more. With --features use-dev-tty the whole paste arrives.
A fix would be to keep reading until the fd returns WouldBlock before returning the first event; the parser already queues every event it parses. Discussion that led here: https://github.com/nushell/reedline/pull/1132#discussion_r4069755646
Activity
0No activity yet.