Win32 mouse coordinates wrong when viewport scrolled #13909

Open
opened 2026-01-31 03:55:34 +00:00 by claunia · 0 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)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13909