possible to resize terminal to a lower width than minimum width #11145

Closed
opened 2026-01-31 02:39:47 +00:00 by claunia · 6 comments
Owner

Originally created by @LuanVSO on GitHub (Oct 23, 2020).

Environment

Windows build number: [10.0.19042.0]
Windows Terminal version (if applicable):1.4.2652.0

Any other software?

Steps to reproduce

  1. grab one of the upper corners of the terminal window
  2. move the mouse to the top of the screen to trigger snap assist
  3. move the mouse to a position above the other corner of the window while still maintaining it at the top of screen
  4. release mouse button

Expected behavior

minimum width is enforced properly

Actual behavior

width is resized based on mouse position
resize

Originally created by @LuanVSO on GitHub (Oct 23, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [10.0.19042.0] Windows Terminal version (if applicable):1.4.2652.0 Any other software? ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. grab one of the upper corners of the terminal window 2. move the mouse to the top of the screen to trigger snap assist 3. move the mouse to a position above the other corner of the window while still maintaining it at the top of screen 4. release mouse button # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> minimum width is enforced properly # Actual behavior <!-- What's actually happening? --> width is resized based on mouse position ![resize](https://user-images.githubusercontent.com/43626415/97038684-8e562580-1541-11eb-806b-c73a90c7fe70.gif)
Author
Owner

@zadjii-msft commented on GitHub (Oct 23, 2020):

Wow yep that's a real bug.

I wonder why the shell even lets that happen. Maybe there's some other window message that's sent for "I'm about to snap you to this size", which we don't reply to.

@zadjii-msft commented on GitHub (Oct 23, 2020): Wow yep that's a real bug. I wonder why the shell even lets that happen. Maybe there's some other window message that's sent for "I'm about to snap you to this size", which we _don't_ reply to.
Author
Owner

@Don-Vito commented on GitHub (Oct 27, 2020):

  • Right now we protect against resizing below minimum by handling WM_SIZING message (in IslandWindow), during which we rewrite the new rectangle coordinates if required
  • When you are dragging a mouse to the top of the screen, the mouse is not captured anymore (we get WM_CAPTURECHANGED). At this point we stop getting WM_SIZING, but rather get a WM_WINDOWPOSCHANGING as the system tries to resize the window to take the full screen height.
  • The WM_WINDOWPOSCHANGING message uses minimal width received earlier from WM_GETMINMAXINFO.
  • Right now we don't implement neither WM_GETMINMAXINFO nor WM_WINDOWPOSCHANGING in IslandWindow. As a result the default min width is used in WM_WINDOWPOSCHANGED and WM_SIZE.

IMHO we need to implement a handler for either WM_GETMINMAXINFO (which can be problematic if we switch the screen to a screen with another dpi-scaling during the resize) or to enforce the minimal size upon WM_WINDOWPOSCHANGING.

I did a nano POC for protection in WM_WINDOWPOSCHANGING (see below). As you can see there is still some artifact of Windows rendering the "future borders" when the mouse button is still clicked. Yet it seems to be better than now. Please let me know if you want me to productize this solution.

EnforceMinWidth

Of course this artifact goes away if we override WM_GETMINMAXINFO (see below), but as mentioned earlier this might not work properly on the boundary of screens with different DPIs. Please let me know if you think this approach (or mix of the approaches is favorable).

EnforceMinWidthWithMinInfo

@zadjii-msft - FYI.

@Don-Vito commented on GitHub (Oct 27, 2020): * Right now we protect against resizing below minimum by handling WM_SIZING message (in IslandWindow), during which we rewrite the new rectangle coordinates if required * When you are dragging a mouse to the top of the screen, the mouse is not captured anymore (we get WM_CAPTURECHANGED). At this point we stop getting WM_SIZING, but rather get a WM_WINDOWPOSCHANGING as the system tries to resize the window to take the full screen height. * The WM_WINDOWPOSCHANGING message uses minimal width received earlier from WM_GETMINMAXINFO. * Right now we don't implement neither WM_GETMINMAXINFO nor WM_WINDOWPOSCHANGING in IslandWindow. As a result the default min width is used in WM_WINDOWPOSCHANGED and WM_SIZE. IMHO we need to implement a handler for either WM_GETMINMAXINFO (which can be problematic if we switch the screen to a screen with another dpi-scaling during the resize) or to enforce the minimal size upon WM_WINDOWPOSCHANGING. I did a nano POC for protection in WM_WINDOWPOSCHANGING (see below). As you can see there is still some artifact of Windows rendering the "future borders" when the mouse button is still clicked. Yet it seems to be better than now. Please let me know if you want me to productize this solution. ![EnforceMinWidth](https://user-images.githubusercontent.com/4639110/97293394-47c03e00-1855-11eb-8735-325afc81e046.gif) Of course this artifact goes away if we override WM_GETMINMAXINFO (see below), but as mentioned earlier this might not work properly on the boundary of screens with different DPIs. Please let me know if you think this approach (or mix of the approaches is favorable). ![EnforceMinWidthWithMinInfo](https://user-images.githubusercontent.com/4639110/97296463-60325780-1859-11eb-8fb4-08cc8301c522.gif) @zadjii-msft - FYI.
Author
Owner

@zadjii-msft commented on GitHub (Oct 27, 2020):

Wow both those look better. I'm thinking the WM_GETMINMAXINFO one looks better to me - how easy is it to hit the weird edge case with different DPI displays (and what does that end up looking like)? I'd definitely be interested in looking over this PR ☺️

@zadjii-msft commented on GitHub (Oct 27, 2020): Wow both those look better. I'm thinking the `WM_GETMINMAXINFO` one looks better to me - how easy is it to hit the weird edge case with different DPI displays (and what does that end up looking like)? I'd definitely be interested in looking over this PR ☺️
Author
Owner

@Don-Vito commented on GitHub (Oct 27, 2020):

Wow both those look better. I'm thinking the WM_GETMINMAXINFO one looks better to me - how easy is it to hit the weird edge case with different DPI displays (and what does that end up looking like)? I'd definitely be interested in looking over this PR ☺️

Cool. I am doing it 😄

@Don-Vito commented on GitHub (Oct 27, 2020): > > > Wow both those look better. I'm thinking the `WM_GETMINMAXINFO` one looks better to me - how easy is it to hit the weird edge case with different DPI displays (and what does that end up looking like)? I'd definitely be interested in looking over this PR ☺️ Cool. I am doing it 😄
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

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

Handy links:

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

@ghost commented on GitHub (Jan 28, 2021):

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

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8066, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.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#11145