Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mouse support #57

Closed
rprichard opened this issue Dec 16, 2015 · 0 comments
Closed

Add mouse support #57

rprichard opened this issue Dec 16, 2015 · 0 comments

Comments

@rprichard
Copy link
Owner

IntelliJ's winpty fork (jediterm -> pty4j -> winpty) has mouse support; upstream winpty should also have it.

Terminals can report mouse movement, button press/release events, and scroll-wheel ticks.

By default, they don't report any of these events, but they can be put into a mode where they do. Once this mode is entered, the default text selection / history navigation is disabled in most terminals, so winpty shouldn't activate mouse mode unless we know it's desired. AFAICT, there's no good way to automatically make this determination -- I thought we could look for the ENABLE_MOUSE_INPUT console mode flag, but that flag is frequently set by programs that don't really care about mouse input, such as native Python 2.7 and Cygwin command-line programs. Therefore, winpty users will need to explicitly opt-in to mouse support.

I have a document I'm working on that will describe how mouse support varies across terminals. My intention is to have a --mouse option in the UNIX adapter whose only role is to enable and disable mouse input. The agent will always recognize mouse escapes, regardless of whether --mouse was passed.

The --mouse option will prefer modes 1003 and 1006, with fallbacks to 1002, 1000, and 1015. The agent will handle any of these modes. It won't support modes 9 (which lacks mouse-release events) or mode 1005 (UTF-8 coordinates create decoding ambiguity).

It might make sense to have more options for --mouse for users who want to avoid the unnecessary traffic, but since no one has even asked me for --mouse, I'm guessing I don't need to bother with it. In any event, --mouse is just a convenience option; users can enable the other modes if they want, e.g.:

printf '\e[?1002h\e[?1006h' && console cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant