Terminal is starting up at a size that's different from initialRows/initialCols #2883

Closed
opened 2026-01-30 23:07:57 +00:00 by claunia · 8 comments
Owner

Originally created by @0xabu on GitHub (Jul 22, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.264]
Windows Terminal version (if applicable): 8ffff8ea 0.2.1991.0
Any other software? WSL

Steps to reproduce

The relevant-looking parts of profiles.json are:

{
    "globals" : 
    {
        "defaultProfile" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
        "initialCols" : 80,
        "initialRows" : 40,
    },
    "profiles" : 
    [
        {
            "commandline" : "wsl.exe -d Ubuntu-18.04",
            "fontFace" : "DejaVu Sans Mono for Powerline",
            "fontSize" : 9,
            "guid" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "padding" : "0, 0, 0, 0"
        }
    ]

Expected behavior

I should see an 80x40 terminal.

Actual behavior

I get an 80x37 terminal, with extra blank horizontal space after the last usable column:

image

Originally created by @0xabu on GitHub (Jul 22, 2019). Originally assigned to: @zadjii-msft on GitHub. # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.264] Windows Terminal version (if applicable): 8ffff8ea 0.2.1991.0 Any other software? WSL ``` # Steps to reproduce The relevant-looking parts of profiles.json are: ``` { "globals" : { "defaultProfile" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}", "initialCols" : 80, "initialRows" : 40, }, "profiles" : [ { "commandline" : "wsl.exe -d Ubuntu-18.04", "fontFace" : "DejaVu Sans Mono for Powerline", "fontSize" : 9, "guid" : "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}", "padding" : "0, 0, 0, 0" } ] ``` # Expected behavior I should see an 80x40 terminal. # Actual behavior I get an 80x37 terminal, with extra blank horizontal space after the last usable column: ![image](https://user-images.githubusercontent.com/13037682/61648053-84b98000-ac63-11e9-896c-453cee71e02a.png)
Author
Owner

@culcube commented on GitHub (Aug 22, 2019):

There appears to be two separate issues here.

  1. Created terminal windows are consistently 3 rows smaller than the value for initialRows.
    e.g. initialRows 27 gives a terminal size of height 24
    Confirmed using powershell's "$Host.UI.RawUI.WindowSize.Height" and Ubuntu bash's "stty size" in their respective tabs.

  2. Extra space appears to the right and bottom of the terminal window, but this isn't part of the terminal's reported size, and doesn't affect output only how the windows looks (at least when checked using an 80x24 (i.e. setting an 80x27, see point 1) terminal window).
    I suspect the window is being drawn at the maximum size it can be without becoming an extra column wider or row taller, Perhaps the pixel size is calculated and 1 is subtracted to avoid a fence-post error, but this subtraction is from the size in pixels, and not the the number of rows or columns.

I can't see a style guide for Bug reporting - is the right thing to do to create two new bugs referencing this one (and then close this one)? To spin one issue out into a new bug and keep this bug open for the other one?

@culcube commented on GitHub (Aug 22, 2019): There appears to be two separate issues here. 1. Created terminal windows are consistently 3 rows smaller than the value for initialRows. e.g. initialRows 27 gives a terminal size of height 24 Confirmed using powershell's "$Host.UI.RawUI.WindowSize.Height" and Ubuntu bash's "stty size" in their respective tabs. 2. Extra space appears to the right and bottom of the terminal window, but this isn't part of the terminal's reported size, and doesn't affect output only how the windows looks (at least when checked using an 80x24 (i.e. setting an 80x27, see point 1) terminal window). I suspect the window is being drawn at the maximum size it can be without becoming an extra column wider or row taller, Perhaps the pixel size is calculated and 1 is subtracted to avoid a fence-post error, but this subtraction is from the size in pixels, and not the the number of rows or columns. I can't see a style guide for Bug reporting - is the right thing to do to create two new bugs referencing this one (and then close this one)? To spin one issue out into a new bug and keep this bug open for the other one?
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2019):

@culcube I'm fairly certain this is all due to the same root cause, so they can all stay in this issue. I believe the root cause is that we're getting the amount of space we need for the actual terminal pane itself, but then no accounting for the window frame. That window frame rounds up to roughly three characters tall on top/bottom, and one character on the left/right. If we accounted for those dimensions correctly when creating the window, both problems would go away.

I believe the IslandWindow is doing this correctly, but NonClientIslandWindow is where the bug lies.

@zadjii-msft commented on GitHub (Aug 22, 2019): @culcube I'm fairly certain this is all due to the same root cause, so they can all stay in this issue. I believe the root cause is that we're getting the amount of space we need for the actual terminal pane itself, but then no accounting for the window frame. That window frame rounds up to roughly three characters tall on top/bottom, and one character on the left/right. If we accounted for those dimensions correctly when creating the window, both problems would go away. I believe the `IslandWindow` is doing this correctly, but `NonClientIslandWindow` is where the bug lies.
Author
Owner

@fpqc commented on GitHub (Sep 30, 2019):

@zadjii-msft I found the source of the issue. It's padding, the scrollbar, and the tab UI. I have tabs, scrollbar, and padding disabled, and I get pixel-perfect accuracy.

Vertical test:
image

image

My terminal is set to 240 x 30, and everything works with perfect accuracy if you look at the screenshots

@fpqc commented on GitHub (Sep 30, 2019): @zadjii-msft I found the source of the issue. It's padding, the scrollbar, and the tab UI. I have tabs, scrollbar, and padding disabled, and I get pixel-perfect accuracy. Vertical test: ![image](https://user-images.githubusercontent.com/6083371/65892792-d0dd1b00-e39e-11e9-8ea7-fd76e8799d46.png) ![image](https://user-images.githubusercontent.com/6083371/65892986-21ed0f00-e39f-11e9-9b22-bbbac6f297c4.png) My terminal is set to 240 x 30, and everything works with perfect accuracy if you look at the screenshots
Author
Owner

@daviox commented on GitHub (Oct 11, 2019):

I'd say it's just tab UI, because I previously had a scrollbar set as hidden and padding set to 5px each. Disabling the tab UI solved the issue, at least in my case.

@daviox commented on GitHub (Oct 11, 2019): I'd say it's just tab UI, because I previously had a scrollbar set as hidden and padding set to 5px each. Disabling the tab UI solved the issue, at least in my case.
Author
Owner

@zypA13510 commented on GitHub (Dec 30, 2019):

Not sure if it's worth mentioning, for me, it's always 2 rows smaller (instead of 3).

@zypA13510 commented on GitHub (Dec 30, 2019): Not sure if it's worth mentioning, for me, it's always 2 rows smaller (instead of 3).
Author
Owner

@zypA13510 commented on GitHub (Mar 23, 2020):

This has still not solved the scaling issue with padding (#4077).

I'm testing with terminal v0.10.781.0, which should include commit 0e33d86.

Under 150% DPI:

  • padding 0 does not cause any issue, console size is at 80x24
  • padding 50 results in a 76x22 console
  • padding 100 and it becomes 72x20

Under 100% DPI:

  • padding 0 is 80x24
  • padding 100 is 80x24
@zypA13510 commented on GitHub (Mar 23, 2020): This has still not solved the scaling issue with padding (#4077). I'm testing with terminal v0.10.781.0, which should include commit 0e33d86. Under 150% DPI: - padding 0 does not cause any issue, console size is at 80x24 - padding 50 results in a 76x22 console - padding 100 and it becomes 72x20 Under 100% DPI: - padding 0 is 80x24 - padding 100 is 80x24
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 23, 2020):

Huh, thanks.

@DHowett-MSFT commented on GitHub (Mar 23, 2020): Huh, thanks.
Author
Owner

@ghost commented on GitHub (Apr 22, 2020):

:tada:This issue was addressed in #5091, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.🎉

Handy links:

@ghost commented on GitHub (Apr 22, 2020): :tada:This issue was addressed in #5091, which has now been successfully released as `Windows Terminal Preview v0.11.1121.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.11.1121.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?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#2883