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

[VT Mouse Mode] Release is not fired when a drag begins inside and exits the terminal window #6401

Closed
o-sdn-o opened this issue Jun 7, 2020 · 7 comments · Fixed by #7166
Closed
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@o-sdn-o
Copy link

o-sdn-o commented Jun 7, 2020

Environment

Windows build number: 10.0.18363.836
WSL profile

Steps to reproduce

Use WSL profile, enable the mouse tracking mode SGR (1006):

echo -e '\e[?1003;1006h'

If you press the mouse button in the terminal window and move the cursor outside the window and release the button there, the application running in the terminal does not receive a message that the button has been released.

When the mouse tracking mode is on, while holding any mouse button and moving the cursor outside the window, the mouse tracking should not stop.

Expected behavior

If the mouse button was pressed inside the terminal, then the message about releasing the mouse button should come even if the mouse cursor has moved outside the window.

Actual behavior

А message about releasing the mouse button (and any tracking messages) does not come if the mouse cursor has moved outside the window.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 7, 2020
@o-sdn-o o-sdn-o changed the title [WSL] When the mouse tracking mode SGR (1006) is on, mouse is not captured when dragging outside the terminal window. Mouse is not captured when dragging outside the terminal window. Jun 7, 2020
@o-sdn-o o-sdn-o changed the title Mouse is not captured when dragging outside the terminal window. Mouse is not captured when dragging outside the terminal window Jun 7, 2020
@DHowett
Copy link
Member

DHowett commented Jun 10, 2020

Great catch. Thanks!

@DHowett DHowett added Area-Input Related to input processing (key presses, mouse, etc.) Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 10, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jun 10, 2020
@DHowett DHowett added this to the Terminal Backlog milestone Jun 10, 2020
@DHowett DHowett changed the title Mouse is not captured when dragging outside the terminal window [VT Mouse Mode] Mouse is not captured when dragging outside the terminal window Jun 10, 2020
@DHowett DHowett changed the title [VT Mouse Mode] Mouse is not captured when dragging outside the terminal window [VT Mouse Mode] Release is not captured when dragging outside the terminal window Jun 10, 2020
@DHowett DHowett changed the title [VT Mouse Mode] Release is not captured when dragging outside the terminal window [VT Mouse Mode] Release is not fired when a drag begins inside and exits the terminal window Jun 10, 2020
@DHowett
Copy link
Member

DHowett commented Jun 10, 2020

(Renamed a bit for tracking purposes.)

@DHowett DHowett added the Help Wanted We encourage anyone to jump in on these. label Jun 10, 2020
@o-sdn-o

This comment has been minimized.

@o-sdn-o
Copy link
Author

o-sdn-o commented Aug 2, 2020

Release is not fired also inside the terminal window when the drag starts inside the grid of cells and goes outside of the grid of cells.

For example, resizing an object does not complete when the mouse button is released while the cursor is in the inactive field to the right:
ezgif-7-f0f01bd46440

This causes great difficulties in full-screen mode, when there are inactive fields along the edges, since the mouse cursor stops just at these inactive fields.

@DHowett
Copy link
Member

DHowett commented Aug 2, 2020

I know that this doesn't move the needle much help solve your issue, but WOW, your TUI looks so cool!

DHowett added a commit that referenced this issue Aug 3, 2020
gnome-terminal (at least) sends mouse events whose x/y are at the
extreme ends of the buffer when a drag starts inside the terminal and
then exits it.

We would previously discard any mouse events that exited the borders of
the viewport. Now we will keep emitting events where X/Y=0/w/h.

Fixes #6401 in Terminal.
DHowett added a commit that referenced this issue Aug 3, 2020
This is the same as 9d727a4, but for conhost. conhost wasn't already
capturing the pointer when VT mouse mode was in use. By capturing, we
ensure that events that happen outside the screen still result in events
sent to an application (like a release after a drag)

Fixes #6401 in conhost.
@ghost ghost added the In-PR This issue has a related PR label Aug 3, 2020
@ghost ghost closed this as completed in #7166 Aug 4, 2020
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Aug 4, 2020
ghost pushed a commit that referenced this issue Aug 4, 2020
This pull request fixes capture and event generation in VT mouse mode
for both conhost and terminal.

Fixes #6401.

[1/3] Terminal: clamp mouse events to the viewport, don't throw them away

 gnome-terminal (at least) sends mouse events whose x/y are at the
 extreme ends of the buffer when a drag starts inside the terminal and
 then exits it.

 We would previously discard any mouse events that exited the borders of
 the viewport. Now we will keep emitting events where X/Y=0/w/h.

[2/3] conhost: clamp VT mouse to viewport, capture pointer

 This is the same as (1), but for conhost. conhost wasn't already
 capturing the pointer when VT mouse mode was in use. By capturing, we
 ensure that events that happen outside the screen still result in events
 sent to an application (like a release after a drag)

[3/3] wpf: capture the pointer when VT mouse is enabled

 This is the same as (2), but for the WPF control. Clamping is handled
 in TerminalCore in (1), so we didn't need to do it in WPF.
DHowett added a commit that referenced this issue Aug 4, 2020
This pull request fixes capture and event generation in VT mouse mode
for both conhost and terminal.

Fixes #6401.

[1/3] Terminal: clamp mouse events to the viewport, don't throw them away

 gnome-terminal (at least) sends mouse events whose x/y are at the
 extreme ends of the buffer when a drag starts inside the terminal and
 then exits it.

 We would previously discard any mouse events that exited the borders of
 the viewport. Now we will keep emitting events where X/Y=0/w/h.

[2/3] conhost: clamp VT mouse to viewport, capture pointer

 This is the same as (1), but for conhost. conhost wasn't already
 capturing the pointer when VT mouse mode was in use. By capturing, we
 ensure that events that happen outside the screen still result in events
 sent to an application (like a release after a drag)

[3/3] wpf: capture the pointer when VT mouse is enabled

 This is the same as (2), but for the WPF control. Clamping is handled
 in TerminalCore in (1), so we didn't need to do it in WPF.

(cherry picked from commit d29be59)
DHowett added a commit that referenced this issue Aug 4, 2020
This pull request fixes capture and event generation in VT mouse mode
for both conhost and terminal.

Fixes #6401.

[1/3] Terminal: clamp mouse events to the viewport, don't throw them away

 gnome-terminal (at least) sends mouse events whose x/y are at the
 extreme ends of the buffer when a drag starts inside the terminal and
 then exits it.

 We would previously discard any mouse events that exited the borders of
 the viewport. Now we will keep emitting events where X/Y=0/w/h.

[2/3] conhost: clamp VT mouse to viewport, capture pointer

 This is the same as (1), but for conhost. conhost wasn't already
 capturing the pointer when VT mouse mode was in use. By capturing, we
 ensure that events that happen outside the screen still result in events
 sent to an application (like a release after a drag)

[3/3] wpf: capture the pointer when VT mouse is enabled

 This is the same as (2), but for the WPF control. Clamping is handled
 in TerminalCore in (1), so we didn't need to do it in WPF.

(cherry picked from commit d29be59)
@ghost
Copy link

ghost commented Aug 13, 2020

🎉This issue was addressed in #7166, which has now been successfully released as Windows Terminal v1.1.2233.0.:tada:

Handy links:

@ghost
Copy link

ghost commented Aug 13, 2020

🎉This issue was addressed in #7166, which has now been successfully released as Windows Terminal Preview v1.2.2234.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants