Skip to content

[Conpty] Add support for mouse input #376

Closed
@wez

Description

@wez

On: Microsoft Windows [Version 10.0.17763.134]

I have implemented conpty in my terminal emulator:
https://github.com/wez/wezterm

I can successfully run target\debug\wezterm.exe to spawn console applications such as cmd.exe powershell.exe and bash.

The issue I'm seeing is that when I launch bash, either indirectly via cmd.exe or directly via the bash launcher, conpty seems to swallow the mouse reporting escape sequences; I don't see them being received by my terminal parser, and thus vim has no effective mouse support despite being configured with set mouse=a.

Running the same WSL install via wsl-terminal does have working mouse support, and wezterm has been my daily driver on Linux for about a year with working mouse support, so we can rule out an obvious misconfiguration with vim and the parser in wezterm.

I've also tried echo -e "\e[?1000h" to manually enable mouse reporting from the shell; normally (on linux and via wsl-terminal) this causes clicks in the terminal to send data to the shell (which appears as garbage input), but when running my terminal with conpty, these are also swallowed up somewhere.

Is there something special needed for the apps that I spawn into my pty to be able to work with the mouse?

In case you want to double check the key portion of the code, the relevant file is:
https://github.com/wez/wezterm/blob/master/src/winpty.rs
The flow is to CreatePipe a pair of pipes, CreatePseudoConsole, and then pass that to a spawned child via the threadproc attributes, as the samples in the MSDN docs and this repo also do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-InteropCommunication between processesIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsProduct-ConptyFor console issues specifically related to conpty

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions