[PR #17659] Add support for querying the DECSCUSR setting #31310

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

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

State: closed
Merged: Yes


Summary of the Pull Request

This PR adds support for querying the cursor style - technically the
state of the DECSCUSR setting - using a DECRQSS escape sequence.

References and Relevant Issues

The initial DECRQSS support was added in PR #11152, but it wasn't
practical to report the cursor style until conpty passthrough was added
in PR #17510.

Detailed Description of the Pull Request / Additional comments

If the user has chosen a cursor style that isn't one of the shapes
supported by the DECSCUSR control, we report those as 0 (i.e. the
default style). That way, if an application later tries to restore the
cursor using the returned value, it should still be reset to its
original state.

I also took the opportunity in this PR to do some refactoring of the
other DECRQSS reports, since several of them were using unnecessary
appending that could be simplified to a single fmt::format call, or
even just static strings in some cases.

Validation Steps Performed

I've checked the reports are working as expected in Vttest, and also
added some unit tests.

PR Checklist

  • Tests added/passed
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17659 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR adds support for querying the cursor style - technically the state of the `DECSCUSR` setting - using a `DECRQSS` escape sequence. ## References and Relevant Issues The initial `DECRQSS` support was added in PR #11152, but it wasn't practical to report the cursor style until conpty passthrough was added in PR #17510. ## Detailed Description of the Pull Request / Additional comments If the user has chosen a cursor style that isn't one of the shapes supported by the `DECSCUSR` control, we report those as 0 (i.e. the default style). That way, if an application later tries to restore the cursor using the returned value, it should still be reset to its original state. I also took the opportunity in this PR to do some refactoring of the other `DECRQSS` reports, since several of them were using unnecessary appending that could be simplified to a single `fmt::format` call, or even just static strings in some cases. ## Validation Steps Performed I've checked the reports are working as expected in Vttest, and also added some unit tests. ## PR Checklist - [x] Tests added/passed
claunia added the pull-request label 2026-01-31 09:46:29 +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#31310