[PR #17148] Fix the DECTCEM reset position in the conpty stream #31136

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

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

State: closed
Merged: Yes


Summary of the Pull Request

When the conpty renderer determines that it needs to hide the cursor,
it does so by inserting a DECTCEM reset sequence at the start of the
output buffer, assuming that is the start of the frame. But when the
_noFlushOnEnd flag is set, you can have multiple frames pending in the
buffer, and the DECTCEM sequence will then end up in the wrong place.

This PR fixes the issue by saving the buffer size at the start of the
frame, and using that saved offset as the insert position for the
DECTCEM sequence.

Validation Steps Performed

I have a game that was frequently affected by this issue (the cursor
would be visible when it was meant to be hidden). With this PR applied,
it now works perfectly.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17148 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request When the conpty renderer determines that it needs to hide the cursor, it does so by inserting a `DECTCEM` reset sequence at the start of the output buffer, assuming that is the start of the frame. But when the `_noFlushOnEnd` flag is set, you can have multiple frames pending in the buffer, and the `DECTCEM` sequence will then end up in the wrong place. This PR fixes the issue by saving the buffer size at the start of the frame, and using that saved offset as the insert position for the `DECTCEM` sequence. ## Validation Steps Performed I have a game that was frequently affected by this issue (the cursor would be visible when it was meant to be hidden). With this PR applied, it now works perfectly. ## PR Checklist - [x] Closes #15449
claunia added the pull-request label 2026-01-31 09:45:20 +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#31136