Skip to content

How to use DECXCPR? (Report Cursor Position) #799

@jazzdelightsme

Description

@jazzdelightsme

The conhost Virtual Terminal Sequences doc describes some "query" codes, among which is DECXCPR, which allows you to query the cursor position:

Sequence Code Description Behavior
ESC [ 6 n DECXCPR Report Cursor Position Emit the cursor position as: ESC [ ; R Where = cursor row and = cursor column

Note These queries will emit their responses into the console input stream immediately after being recognized on the output stream while ENABLE_VIRTUAL_TERMINAL_PROCESSING is set. The ENABLE_VIRTUAL_TERMINAL_INPUT flag does not apply to query commands as it is assumed that an application making the query will always want to receive the reply.

I'm trying to figure out how to use this sequence. Ideally what I'd like to be able to do is register a handler of some sort, so that when I emit CSI 6 n to the output stream, my handler gets called with the info from the "reply" VT sequence that conhost injects into the input.

I came to look around the source, and found that it looks like @parkovski has already added the foundation for handling VT sequences in the input stream (#564). Fantastic! But now I need to figure out how to wire it up.

I'm hoping that @parkovski or lzybkr could give some direction / guidance / jumpstart on what the right way to do that would be, which would save me a lot of time trying to understand how things work based solely on the code.

TIA!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions