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

Inconsistent gutters/margins on HiDPI displays with snapToGridOnResize #4175

Open
DHowett-MSFT opened this issue Jan 10, 2020 · 10 comments
Open
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Milestone

Comments

@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented Jan 10, 2020

It looks like on my 200% scale device it's snapping at the half-grid.


A 50x15 window at 150% scale with Ctrl+Shift+A:
image

After resizing the window to 51x15:
image

@DHowett-MSFT DHowett-MSFT added Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Jan 10, 2020
@DHowett-MSFT DHowett-MSFT added this to the Terminal v1.0 milestone Jan 10, 2020
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jan 10, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jan 13, 2020
@zadjii-msft zadjii-msft added the Priority-3 A description (P3) label Jan 22, 2020
@randomascii
Copy link

At 125% scaling it seems to have a variable padding at the bottom. As you size the window up from the bottom, one line at a time, it actually shrinks the window by some lesser amount - probably 80% of a line.

Even at 100% it is not totally reliable. When you expand the height of the window the newly revealed line will sometimes not render (even though there is content there) but if you scroll up and down the content will appear.

@DHowett-MSFT DHowett-MSFT self-assigned this Apr 25, 2020
@DHowett DHowett assigned DHowett and unassigned DHowett-MSFT May 17, 2020
@zadjii-msft zadjii-msft added the good first issue This is a fix that might be easier for someone to do as a first contribution label Aug 7, 2020
@zadjii-msft zadjii-msft modified the milestones: Terminal v2.0, 22H2 Jan 4, 2022
@MVS-99
Copy link

MVS-99 commented Dec 28, 2022

Is there a solution yet for this kind of issue??? Mostly appears when changing terminal from one screen to another.

@meshkinyar
Copy link

meshkinyar commented Jan 3, 2023

Is there a solution yet for this kind of issue??? Mostly appears when changing terminal from one screen to another.

A hacky solution I found is creating a PNG that is just filled with your set background color and then setting that to the background image of your current profile. No random padding (at least any that's visible anyway).

The space seems to be leftover padding for the scrollbars that just isn't cleaned due to display scaling. It's just strange that having an image background seems to hide this problem. My guess is that the problem is visible due to there being an unset "application background" that the terminal is rendered on top of when not set to an image. In my case it could also be an out-of-gamut accent color but I really don't know.

@zadjii-msft zadjii-msft moved this to Should be written in Terminal Walkthroughs Feb 6, 2023
@zadjii-msft zadjii-msft modified the milestones: 22H2, Backlog Jul 5, 2023
@egorlepa

This comment was marked as off-topic.

@DHowett

This comment was marked as off-topic.

@egorlepa

This comment was marked as off-topic.

@lhecker lhecker changed the title snapToGridOnResize gets grid size wrong on HiDPI devices Inconsistent gutters/margins on HiDPI displays with snapToGridOnResize Aug 30, 2023
@zadjii-msft
Copy link
Member

float TermControl::SnapDimensionToGrid(const bool widthOrHeight, const float dimension)
{
const auto fontSize = _core.FontSize();
const auto fontDimension = widthOrHeight ? fontSize.Width : fontSize.Height;
const auto padding = GetPadding();
auto nonTerminalArea = gsl::narrow_cast<float>(widthOrHeight ?
padding.Left + padding.Right :
padding.Top + padding.Bottom);
if (widthOrHeight && _core.Settings().ScrollState() != ScrollbarState::Hidden)
{
nonTerminalArea += gsl::narrow_cast<float>(ScrollBar().ActualWidth());
}
const auto gridSize = dimension - nonTerminalArea;
const auto cells = floor(gridSize / fontDimension);
return cells * fontDimension + nonTerminalArea;
}

Pretty sure this just doesn't account for DIPs vs pixels at all. Never has. I'd reckon that dimension is in DIPs and fontSize is in pixels. Someone could pretty easily fix that

@rp1231
Copy link

rp1231 commented Feb 22, 2024

Screenshot 2024-02-22 113426
I'm having this problem as well on a 4k display.
Used a white background to show the borders.
Is there any way to totally get rid of the borders from all sides?

@MarcoBuess
Copy link

Seeing that this is open for almost a year, is this still being worked on? As it seems its still relevant. #17721 mentions 1.23 as a potential candidate that adresses this, am I understanding correctly?

@Ali-Nu
Copy link

Ali-Nu commented Jan 7, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
Status: Should be written
Development

No branches or pull requests