Describe the bug
Using a MinTTY terminal on Windows, user starts Copilot CLI then exits, the terminal is left with button-event mouse tracking mode still enabled.
This means any clicks in the terminal no longer do the usual copy/paste/menu actions but instead cause escape sequences to be input to the terminal.
There are several mouse tracking modes, documented:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
┌──────────────────────────┬─────────────┬─────────────┐
│ Mode │ Enable │ Disable │
├──────────────────────────┼─────────────┼─────────────┤
│ Normal click tracking │ \e[?1000h │ \e[?1000l │
├──────────────────────────┼─────────────┼─────────────┤
│ Button-event tracking │ \e[?1002h │ \e[?1002l │
├──────────────────────────┼─────────────┼─────────────┤
│ Any-event tracking │ \e[?1003h │ \e[?1003l │
├──────────────────────────┼─────────────┼─────────────┤
│ SGR extended coordinates │ \e[?1006h │ \e[?1006l │
└──────────────────────────┴─────────────┴─────────────┘
The mode which is being left enabled is 1002: Button-event tracking, and 1006: SGR extended coordinates.
The current setting can be queried with \e[?<mode>$p which gives a response \e[?<mode>;<value>$y
Where <value> is:
┌───────┬───────────────────┐
│ Value │ Meaning │
├───────┼───────────────────┤
│ 1 │ Set (enabled) │
├───────┼───────────────────┤
│ 2 │ Reset (disabled) │
├───────┼───────────────────┤
│ 0 │ Not recognized │
├───────┼───────────────────┤
│ 3 │ Permanently set │
├───────┼───────────────────┤
│ 4 │ Permanently reset │
└───────┴───────────────────┘
Example — query normal click tracking (mode 1000):
bash$ echo -e '\e[?1002$p'
Terminal replies e.g. \e[?1002;2$y → mode 1000 is disabled.
In a fresh terminal, all four modes report 2: Reset (disabled).
After copilot has run and exited the terminal reports mode 1002 and 1006 are still enabled (1). Disabling mode 1002 fixed the terminal behaviour.
Affected version
GitHub Copilot CLI 1.0.34.
Steps to reproduce the behavior
echo -e '\e[?1002$p. Response is \e[?1002;1$y - disabled: good.
copilot
/exit (or Ctrl-C Ctrl-C)
echo -e '\e[?1002$p. Response is \e[?1002;2$y - enabled: BUG
- Left-click and drag in the terminal produces a stream of escape sequences: BUG
Expected behavior
echo -e '\e[?1002$p. Response is \e[?1002;1$y - disabled: good.
copilot
/exit (or Ctrl-C Ctrl-C)
echo -e '\e[?1002$p. Response is \e[?1002;1$y - still disabled: good
- Left-click and drag in the terminal produces a selection. Right-click produces the menu.
Additional context
Affected terminals:
Cygwin mintty v 3.7.8 (x86_64-pc-cygwin) [Windows 26220]
Git Bash mintty v 3.8.2 (Msys-x86_64) [Windows 26220]
Describe the bug
Using a MinTTY terminal on Windows, user starts Copilot CLI then exits, the terminal is left with button-event mouse tracking mode still enabled.
This means any clicks in the terminal no longer do the usual copy/paste/menu actions but instead cause escape sequences to be input to the terminal.
There are several mouse tracking modes, documented:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
The mode which is being left enabled is 1002: Button-event tracking, and 1006: SGR extended coordinates.
The current setting can be queried with
\e[?<mode>$pwhich gives a response\e[?<mode>;<value>$yWhere
<value>is:Example — query normal click tracking (mode 1000):
bash$ echo -e '\e[?1002$p'Terminal replies e.g.
\e[?1002;2$y→ mode 1000 is disabled.In a fresh terminal, all four modes report
2: Reset (disabled).After copilot has run and exited the terminal reports mode 1002 and 1006 are still enabled (
1). Disabling mode 1002 fixed the terminal behaviour.Affected version
GitHub Copilot CLI 1.0.34.
Steps to reproduce the behavior
echo -e '\e[?1002$p. Response is\e[?1002;1$y- disabled: good.copilot/exit(or Ctrl-C Ctrl-C)echo -e '\e[?1002$p. Response is\e[?1002;2$y- enabled: BUGExpected behavior
echo -e '\e[?1002$p. Response is\e[?1002;1$y- disabled: good.copilot/exit(or Ctrl-C Ctrl-C)echo -e '\e[?1002$p. Response is\e[?1002;1$y- still disabled: goodAdditional context
Affected terminals:
Cygwin mintty v 3.7.8 (x86_64-pc-cygwin) [Windows 26220]
Git Bash mintty v 3.8.2 (Msys-x86_64) [Windows 26220]