Win32 mouse coordinates wrong when viewport scrolled #13914

Closed
opened 2026-01-31 03:55:42 +00:00 by claunia · 12 comments
Owner

Originally created by @malxau on GitHub (May 26, 2021).

Originally assigned to: @PankajBhojwani on GitHub.

Windows Terminal version (or Windows build number)

1.9.1445.0

Other Software

Using Yori's mouseover support, but anything else should work. It's just unnatural to observe this with a TUI application like FAR manager (why scroll the viewport for a full screen TUI application?) However, scrolling the viewport should show the same behavior for anything.

Steps to reproduce

  1. Fill the console with output until it scrolls.
  2. Manually scroll the viewport up.
  3. Generate mouse events and observe the coordinates that the event contains.

Expected Behavior

Since I know Dustin doesn't like the idea of applications being able to address regions that have scrolled off the visible portion of the display at the bottom, I was expecting the application to observe coordinates corresponding to mouse location if that location is visible at the bottom of the viewport. If the cell is not visible at the bottom of the viewport, I was expecting the reported location to be capped.

Actual Behavior

The reported mouse coordinates assume that the window has not scrolled and report coordinates on the assumption that the visible viewport is the same as the bottom of the scroll region. This causes the application to highlight/select the wrong text, several lines below where the mouse is positioned.

terminal_mouseover

Originally created by @malxau on GitHub (May 26, 2021). Originally assigned to: @PankajBhojwani on GitHub. ### Windows Terminal version (or Windows build number) 1.9.1445.0 ### Other Software Using Yori's mouseover support, but anything else should work. It's just unnatural to observe this with a TUI application like FAR manager (why scroll the viewport for a full screen TUI application?) However, scrolling the viewport should show the same behavior for anything. ### Steps to reproduce 1. Fill the console with output until it scrolls. 2. Manually scroll the viewport up. 3. Generate mouse events and observe the coordinates that the event contains. ### Expected Behavior Since I know Dustin doesn't like the idea of applications being able to address regions that have scrolled off the visible portion of the display at the bottom, I was expecting the application to observe coordinates corresponding to mouse location if that location is visible at the bottom of the viewport. If the cell is not visible at the bottom of the viewport, I was expecting the reported location to be capped. ### Actual Behavior The reported mouse coordinates assume that the window has not scrolled and report coordinates on the assumption that the visible viewport is the same as the bottom of the scroll region. This causes the application to highlight/select the wrong text, several lines below where the mouse is positioned. ![terminal_mouseover](https://user-images.githubusercontent.com/17101641/119581871-4cf85380-bd78-11eb-93c5-830673d3c358.gif)
Author
Owner

@DHowett commented on GitHub (May 26, 2021):

If I had to guess, this is a regression from the recent Interactivity work in TermControl. @zadjii-msft mind having a look?

@DHowett commented on GitHub (May 26, 2021): If I had to guess, this is a regression from the recent Interactivity work in TermControl. @zadjii-msft mind having a look?
Author
Owner

@DHowett commented on GitHub (May 27, 2021):

Confirming that all mouse mode input happens relative to the control and not to the viewport after #9820.

@DHowett commented on GitHub (May 27, 2021): Confirming that all mouse mode input happens relative to the control and not to the viewport after #9820.
Author
Owner

@DHowett commented on GitHub (Jul 13, 2021):

It looks like this isn't a regression from 1.8 (Stable) due to the Control/Interactivity refactoring. I'm going to demote it back to P2 and schedule it for 1.11!

@DHowett commented on GitHub (Jul 13, 2021): It looks like this isn't a regression from 1.8 (Stable) due to the Control/Interactivity refactoring. I'm going to demote it back to P2 and schedule it for 1.11!
Author
Owner

@ghost commented on GitHub (Aug 31, 2021):

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

Handy links:

@ghost commented on GitHub (Aug 31, 2021): :tada:This issue was addressed in #10642, which has now been successfully released as `Windows Terminal Preview v1.10.2383.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.10.2383.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Aug 31, 2021):

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

Handy links:

@ghost commented on GitHub (Aug 31, 2021): :tada:This issue was addressed in #10642, which has now been successfully released as `Windows Terminal Preview v1.11.2421.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.11.2421.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@malxau commented on GitHub (Sep 20, 2021):

I still see the buggy behavior on Terminal 1.11.2421.0, which is supposed to have this fix.

@malxau commented on GitHub (Sep 20, 2021): I still see the buggy behavior on Terminal 1.11.2421.0, which is supposed to have this fix.
Author
Owner

@DHowett commented on GitHub (Sep 20, 2021):

Huh. I am as well.

@PankajBhojwani, did this regress? If so, why didn't the test catch it?

@DHowett commented on GitHub (Sep 20, 2021): Huh. I am as well. @PankajBhojwani, did this regress? If so, why didn't the test catch it?
Author
Owner

@DHowett commented on GitHub (Sep 20, 2021):

Since I can't send you messages images on Teams (thanks Teams):

wt-1 12-bug-mouse-offset

@DHowett commented on GitHub (Sep 20, 2021): Since I can't send you messages images on Teams (thanks Teams): ![wt-1 12-bug-mouse-offset](https://user-images.githubusercontent.com/189190/134057024-09b365b8-dfae-4349-b75e-0f618659e7d8.gif)
Author
Owner

@PankajBhojwani commented on GitHub (Sep 20, 2021):

This never regressed, turns out we only did the mouse coordinate adjustment for pointer pressed, not for release/move/wheel 🤦

Pushed a PR for it, and the test didn't catch it because we don't actually have a way right now to test if mouse events were generated

@PankajBhojwani commented on GitHub (Sep 20, 2021): This never regressed, turns out we only did the mouse coordinate adjustment for pointer pressed, not for release/move/wheel 🤦 Pushed a PR for it, and the test didn't catch it because we don't actually have a way right now to [test if mouse events were generated](https://github.com/microsoft/terminal/issues/7001)
Author
Owner

@ghost commented on GitHub (Oct 4, 2021):

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

Handy links:

@ghost commented on GitHub (Oct 4, 2021): :tada:This issue was addressed in #11290, which has now been successfully released as `Windows Terminal v1.10.2714.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.10.2714.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Oct 4, 2021):

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

Handy links:

@ghost commented on GitHub (Oct 4, 2021): :tada:This issue was addressed in #11290, which has now been successfully released as `Windows Terminal Preview v1.11.2731.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.11.2731.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Oct 20, 2021):

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

Handy links:

@ghost commented on GitHub (Oct 20, 2021): :tada:This issue was addressed in #11290, which has now been successfully released as `Windows Terminal Preview v1.12.2922.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.12.2922.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13914