{"action":"closed","issue":{"url":"https://api.github.com/repos/rprichard/winpty/issues/57","labels_url":"https://api.github.com/repos/rprichard/winpty/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/rprichard/winpty/issues/57/comments","events_url":"https://api.github.com/repos/rprichard/winpty/issues/57/events","html_url":"https://github.com/rprichard/winpty/issues/57","id":122426424,"number":57,"title":"Add mouse support","user":{"login":"rprichard","id":1572855,"avatar_url":"https://avatars.githubusercontent.com/u/1572855?v=3","gravatar_id":"","url":"https://api.github.com/users/rprichard","html_url":"https://github.com/rprichard","followers_url":"https://api.github.com/users/rprichard/followers","following_url":"https://api.github.com/users/rprichard/following{/other_user}","gists_url":"https://api.github.com/users/rprichard/gists{/gist_id}","starred_url":"https://api.github.com/users/rprichard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rprichard/subscriptions","organizations_url":"https://api.github.com/users/rprichard/orgs","repos_url":"https://api.github.com/users/rprichard/repos","events_url":"https://api.github.com/users/rprichard/events{/privacy}","received_events_url":"https://api.github.com/users/rprichard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rprichard/winpty/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-16T04:28:47Z","updated_at":"2015-12-16T12:22:37Z","closed_at":"2015-12-16T12:22:37Z","body":"IntelliJ's winpty fork ([jediterm](https://github.com/JetBrains/jediterm) -> [pty4j](https://github.com/traff/pty4j) -> [winpty](https://github.com/traff/winpty)) has mouse support; upstream winpty should also have it.\r\n\r\n - https://github.com/traff/winpty/commit/a6058e8da03487f317bf8d3781ddd2e5f4109d36\r\n - https://github.com/traff/winpty/commit/aeb71002c7751caf2fc104a2c541720c60c0549c\r\n\r\nTerminals can report mouse movement, button press/release events, and scroll-wheel ticks.\r\n\r\nBy 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.\r\n\r\nI 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.\r\n\r\nThe `--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).\r\n\r\nIt 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.:\r\n```\r\nprintf '\\e[?1002h\\e[?1006h' && console cmd\r\n```\r\n"}}