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

Text display area does not scale correctly #11317

Closed
zdavidsen opened this issue Sep 23, 2021 · 17 comments · Fixed by #12713
Closed

Text display area does not scale correctly #11317

zdavidsen opened this issue Sep 23, 2021 · 17 comments · Fixed by #12713
Assignees
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. zAskModeBug

Comments

@zdavidsen
Copy link

Windows Terminal version (or Windows build number)

Windows Terminal version 1.10.2383.0

Other Software

No response

Steps to reproduce

  1. Open Windows terminal (spawns on primary/1080p monitor)
  2. Execute commands till text reaches the bottom of the window
  3. Move window to secondary monitor (4k, 125% scaling)
  4. Text at bottom and right is cut off, and scrolling does not update the bottom of the window
  5. Input is also cut off at the bottom, so I can't see what I'm typing

Expected Behavior

The text display area should scale correctly

Actual Behavior

Window on 1080p monitor:
image

Window on 4k monitor:
image

Scrolling also seems to only affect the top 3 lines while on the 4k display?
image

And there's also something about cutting off the output of commands above the fold, which seems to apply regardless of monitor:
image

I also just accidentally discovered that resizing the window fixes both the text display area and the scrolling issue on the 4k monitor

@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 Sep 23, 2021
@zadjii-msft zadjii-msft added the Product-Terminal The new Windows Terminal. label Sep 24, 2021
@zadjii-msft
Copy link
Member

From #11525:
image

@zadjii-msft zadjii-msft added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) labels Oct 18, 2021
@zadjii-msft zadjii-msft added this to the Terminal v1.13 milestone Oct 18, 2021
@zadjii-msft zadjii-msft added the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Oct 18, 2021
@zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft added the Needs-Discussion Something that requires a team discussion before we can proceed label Oct 18, 2021
@zadjii-msft zadjii-msft removed the Needs-Discussion Something that requires a team discussion before we can proceed label Oct 25, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 25, 2021
@zadjii-msft
Copy link
Member

From @itsamemarkus in 11659

Windows Terminal version (or Windows build number)

1.11.2921.0

Steps to reproduce

Use 4k and lower resolution monitor. Start new terminal session on lower resolution monitor. Drag window from lower resolution monitor to 4k monitor.

windows-terminal.mp4

Windows Terminal 1.11.2921.0 Windows 21H1 19043.1320

BitsPerPixel : 32
Bounds       : {X=3840,Y=1,Width=1680,Height=1050}
DeviceName   : \\.\DISPLAY1
Primary      : False
WorkingArea  : {X=3840,Y=1,Width=1680,Height=1010}

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY2
Primary      : True
WorkingArea  : {X=0,Y=0,Width=1920,Height=1040}

BitsPerPixel : 32
Bounds       : {X=-1680,Y=0,Width=1680,Height=1050}
DeviceName   : \\.\DISPLAY3
Primary      : False
WorkingArea  : {X=-1680,Y=0,Width=1680,Height=1010}

@zadjii-msft zadjii-msft removed Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Priority-2 A description (P2) labels Feb 8, 2022
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Feb 8, 2022
@lhecker
Copy link
Member

lhecker commented Feb 13, 2022

I have two 4k monitors and set one to 100% and the other to 300% scale.
With that setup I can't replicate this issue in Windows Terminal 1.12.10393.0 on Windows 11.

Do we maybe have to swap these two lines?

SetWindowPos(hWnd, nullptr, lprcNewScale->left, lprcNewScale->top, lprcNewScale->right - lprcNewScale->left, lprcNewScale->bottom - lprcNewScale->top, SWP_NOZORDER | SWP_NOACTIVATE);
_currentDpi = uDpi;

@zadjii-msft zadjii-msft added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. labels Feb 14, 2022
@zadjii-msft
Copy link
Member

See, I dunno about that. I feel like the root cause has got to be somewhere in the TermControl / Renderer area. Look at the screenshot above. The scrollbar is positioned correctly, but seemingly the DX surface isn't? Either the SpawChainPanel didn't get resized up, or the Control didn't resize the actual swapchain to the new size.

It's just annoying that we seemingly can't get a local repro even with a bunch of reports of this 😕 Even if we did have a psychic debugging theory why this happened, we'd have no way to confirm the fix.

@itsamemarkus
Copy link

itsamemarkus commented Feb 14, 2022

I haven't changed my setup except regular updates and the bug appears to be gone.

Current version where I don't have the bug
Windows Terminal 1.11.3471.0 Windows 21H2 19044.1526

Version where I experienced the bug
Windows Terminal 1.11.2921.0 Windows 21H1 19043.1320

@zadjii-msft
Copy link
Member

Hey anyone who's still hitting this: (@zdavidsen, @flcdrg, @itsamemarkus, I think @oising was as well) - any chance you're using the font object in your profile settings somewhere? The fix in #12492 just has me curious.

@zdavidsen
Copy link
Author

zdavidsen commented Feb 15, 2022

Hey anyone who's still hitting this: (zdavidsen, flcdrg, itsamemarkus, I think oising was as well) - any chance you're using the font object in your profile settings somewhere? The fix in 12492 just has me curious.

Huh, changing the font seems to do it. Default is 12, I have all of my profiles set to 10. If I change them back to 12, then the scaling issue goes away. (I only tested it with the cmd profile)

@zadjii-msft
Copy link
Member

WHAT

@zdavidsen
Copy link
Author

I just double checked and the scrolling issue I mentioned seems to be fixed as well, regardless of text size. Haven't really been watching that one, so I'm not sure when that changed

@lhecker lhecker self-assigned this Feb 15, 2022
@flcdrg
Copy link

flcdrg commented Feb 15, 2022

@zadjii-msft my profile is here

The only reference to font is for PowershellCore

               "font": 
                {
                    "face": "CaskaydiaCove NF"
                },

though that is my default profile. I have not changed the font size

@ghost ghost added In-PR This issue has a related PR and removed In-PR This issue has a related PR labels Feb 15, 2022
@lhecker
Copy link
Member

lhecker commented Feb 15, 2022

Alright so for some weird reason I can only consistently reproduce it if I do these exact steps:

  • use Cascadia Code 10pt
  • print text (Get-Help Get-ChildItem)
  • then resize the window to be smaller
  • then scroll up slightly
  • and only then move the window to the higher DPI one

Horrifying.

@oising
Copy link
Collaborator

oising commented Feb 16, 2022

I'm not sure if this is related, but if I have terminal on my external monitor, then undock, I always get a screwed up/clipped window. Maximize/restore fixes it. I just got used to it. Example:

image

@oising
Copy link
Collaborator

oising commented Feb 16, 2022

And yes, I use a one of the nerdfonts modified Cascadia fonts, I think (for oh-my-posh) -- note that I have force full repaint on for that other bug.

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": "toggleShaderEffects",
            "keys": "shift+f10"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "toggleFocusMode",
            "keys": "shift+f11"
        },
        {
            "command": "unbound",
            "keys": "win+`"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "quakeMode"
            },
            "keys": "ctrl+`"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "experimental.rendering.forceFullRepaint": true,
    "experimental.rendering.software": false,
    "profiles": 
    {
        "defaults": 
        {
            "antialiasingMode": "cleartype",
            "colorScheme": "Vintage",
            "font": 
            {
                "face": "FiraCode NF Retina"
            },
            "opacity": 100,
            "useAcrylic": true
        },
        "list": 
        [
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "backgroundImage": null,
                "backgroundImageOpacity": 0.75,
                "backgroundImageStretchMode": "fill",
                "colorScheme": "Vintage",
                "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
                "experimental.retroTerminalEffect": false,
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "intenseTextStyle": "bright",
                "name": "PowerShell",
                "opacity": 100,
                "source": "Windows.Terminal.PowershellCore",
                "useAcrylic": true
            },
            {
                "commandline": "pwsh.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation}\"",
                "guid": "{febde9c2-43c9-4971-9499-a96a69a6a89b}",
                "icon": "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png",
                "name": "Developer PowerShell for VS 2019"
            },
            {
                "commandline": "%comspec%  /k \"%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat\"",
                "guid": "{ba122f80-9cdf-47b8-ba11-ce8955bb212f}",
                "icon": "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png",
                "name": "Developer Command Prompt for VS 2019"
            },
            {
                "colorScheme": "Vintage",
                "guid": "{a3a2e83a-884a-5379-baa8-16f193a13b21}",
                "hidden": false,
                "name": "PowerShell 7 Preview",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{ee76f40e-e821-5b26-819e-d1c8414e1e57}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2022 [Preview]",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{823e2542-ca2f-5a92-99a7-6bceebe80ef3}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2022 [Preview]",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{f137a298-4fbc-55df-b998-45767d3e5339}",
                "hidden": true,
                "name": "Developer Command Prompt for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{b5e4d867-8168-5ec8-8ac7-38c60e470e4d}",
                "hidden": true,
                "name": "Developer PowerShell for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ],
    "startOnUserLogin": true,
    "windowingBehavior": "useAnyExisting"
}

@zdavidsen
Copy link
Author

Just in case this helps at all, here's my full profile

@zadjii-msft zadjii-msft removed the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Mar 10, 2022
@ghost ghost added the In-PR This issue has a related PR label Mar 17, 2022
@ghost ghost closed this as completed in #12713 Mar 24, 2022
ghost pushed a commit that referenced this issue Mar 24, 2022
Previously we would only call `SetWindowSize` and `TriggerRedrawAll` if the
viewport size in characters changed. This commit removes the limitation.
Since the if-condition limiting full redraws is now gone, this commit
moves the responsibility of limiting the calls up the call chain.
With `_refreshSizeUnderLock` now being a heavier function call
than before, some surrounding code was thus refactored.

## PR Checklist
* [x] Closes #11317
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

Test relevant for #11317:
* Print text, filling the entire window
* Move the window from a 150% scale to a 300% scale monitor
* The application works as expected ✅

Regression tests:
* Text zoom with Ctrl+Plus/Minus/0 works as before ✅
* Resizing a window works as before ✅
* No deadlocks, etc. during settings updates ✅
@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 Mar 24, 2022
DHowett pushed a commit that referenced this issue Mar 28, 2022
Previously we would only call `SetWindowSize` and `TriggerRedrawAll` if the
viewport size in characters changed. This commit removes the limitation.
Since the if-condition limiting full redraws is now gone, this commit
moves the responsibility of limiting the calls up the call chain.
With `_refreshSizeUnderLock` now being a heavier function call
than before, some surrounding code was thus refactored.

## PR Checklist
* [x] Closes #11317
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

Test relevant for #11317:
* Print text, filling the entire window
* Move the window from a 150% scale to a 300% scale monitor
* The application works as expected ✅

Regression tests:
* Text zoom with Ctrl+Plus/Minus/0 works as before ✅
* Resizing a window works as before ✅
* No deadlocks, etc. during settings updates ✅

(cherry picked from commit 9fa4169)
@ghost ghost mentioned this issue Apr 8, 2022
@DHowett DHowett added Priority-1 A description (P1) zAskModeBug and removed Priority-3 A description (P3) labels Apr 12, 2022
@ghost
Copy link

ghost commented Apr 19, 2022

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

Handy links:

@ghost
Copy link

ghost commented Apr 19, 2022

🎉This issue was addressed in #12713, which has now been successfully released as Windows Terminal Preview v1.13.1098.: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-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. zAskModeBug
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

7 participants