mirror of
https://github.com/zellij-org/zellij.git
synced 2026-10-11 22:50:07 +00:00
* fix(input): realign raw-byte buffer with the keyboard parser to stop stale bytes eating keystrokes After a paste (e.g. via a clipboard manager like maccy), zellij's current_buffer can hold up to a few stale bytes that termwiz's InputParser has already consumed into events. Those stale bytes are then attached to the raw payload of subsequent KeyEvent messages, desyncing each keystroke from the bytes that produced it: keys go missing, come out garbled, or drop into vi command mode. The root cause is that parse_with_consumed reports consumption relative to its internal self.buf, while stdin_handler drains a separately accumulated current_buffer. The two can drift apart whenever a read leaves a partial sequence that the parser holds under maybe_more. Reconcile the two after every parse: trim current_buffer to the parser's buffered length, so no byte the parser has already decoded is ever forwarded with a later key event. Add InputParser::buffered_len to the vendored termwiz for that purpose. * fix: remove parsed bytes from front rather than back * rustfmt --------- Co-authored-by: Aram Drevekenin <[email protected]>