[PR #17738] Fix input sequences split across the buffer boundary #31344

Open
opened 2026-01-31 09:46:41 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17738

State: closed
Merged: Yes


Summary of the Pull Request

When conhost receives input from a conpty connection, and that input
arrives in a block larger than our 4K buffer, we can end up with a VT
sequence that's split at the buffer boundary. Previously that could
result in the start of the sequence being dropped, and the remaining
characters being interpreted as individual key presses.

This PR attempts to fix the issue by caching the unprocessed characters
from the start of the sequence, and then combining them with the second
half of the sequence when it's later received.

Validation Steps Performed

I've confirmed that pasting into vim now works correctly with the sample
data from issue #16655. I've also tested with a DECCTR report larger
than 4K which would previously have been corrupted, and which now works
as expected.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17738 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request When conhost receives input from a conpty connection, and that input arrives in a block larger than our 4K buffer, we can end up with a VT sequence that's split at the buffer boundary. Previously that could result in the start of the sequence being dropped, and the remaining characters being interpreted as individual key presses. This PR attempts to fix the issue by caching the unprocessed characters from the start of the sequence, and then combining them with the second half of the sequence when it's later received. ## Validation Steps Performed I've confirmed that pasting into vim now works correctly with the sample data from issue #16655. I've also tested with a `DECCTR` report larger than 4K which would previously have been corrupted, and which now works as expected. ## PR Checklist - [x] Closes #16655
claunia added the pull-request label 2026-01-31 09:46:41 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31344