one line moved up when maximizing Terminal #18419

Closed
opened 2026-01-31 06:13:22 +00:00 by claunia · 3 comments
Owner

Originally created by @jackyzy823 on GitHub (Sep 10, 2022).

Windows Terminal version

1.14.2281.0

Windows build number

10.0.19042.1526

Other Software

No response

Steps to reproduce

Make Terminal in maximized status and prompt in the last line
before

Then just minimize and maximize by click Taskbar twice

after

It is obviously a line moved up.

Then just type some char
afterandinput

Repeat above steps
afterandinput_repeat

Expected Behavior

The prompt still in the last line , not automatically (wrongly) move up one line after maximize.

Actual Behavior

It moves up one line.

Originally created by @jackyzy823 on GitHub (Sep 10, 2022). ### Windows Terminal version 1.14.2281.0 ### Windows build number 10.0.19042.1526 ### Other Software _No response_ ### Steps to reproduce Make Terminal in **maximized status** and prompt in the last line ![before](https://user-images.githubusercontent.com/2900871/189484638-6b1eb2a9-10c7-4a4c-a3af-ad6a02dd9feb.PNG) Then just **minimize** and **maximize** by click Taskbar twice ![after](https://user-images.githubusercontent.com/2900871/189484664-b4155d3c-89df-4f9e-abc7-045a4ed77b05.PNG) It is obviously a line moved up. Then just type some char ![afterandinput](https://user-images.githubusercontent.com/2900871/189484679-40deb12d-af17-448e-88bf-fc6f1b113d64.PNG) Repeat above steps ![afterandinput_repeat](https://user-images.githubusercontent.com/2900871/189484681-78f1e837-c51d-405b-a76e-7c8998199eee.PNG) ### Expected Behavior The prompt still in the last line , not automatically (wrongly) move up one line after maximize. ### Actual Behavior It moves up one line.
Author
Owner

@zadjii-msft commented on GitHub (Mar 22, 2023):

Some cursory notes:

  • The PsReadline cursor position is wrong, but that was fixed in a more recent psreadline build.
  • Why is the Terminal resizing though? That's weird. Just maximizing / minimizing the Terminal shouldn't resize the window. It should just swap between the two states. Weird.
@zadjii-msft commented on GitHub (Mar 22, 2023): Some cursory notes: * The PsReadline cursor position is wrong, but that was fixed in a more recent psreadline build. * Why is the Terminal resizing though? That's weird. Just maximizing / minimizing the Terminal shouldn't resize the window. It should just swap between the two states. Weird.
Author
Owner

@j4james commented on GitHub (Apr 6, 2024):

This has been annoying me recently, so I tried to find out what was causing the issue, and it looks to me like it might be the XAML framework that is giving us the wrong size. When I minimize the terminal, I receive a height in the ControlCore::SizeChanged handler that is 8 pixels smaller than what it should be (this translates to 16 device pixels, since my display scaling is 200%).

I don't know if this is something we can fix, but as a workaround, I've discovered that you can prevent it from triggering a scroll just by tweaking the window padding. The idea is to adjust the available height so that the maximized size and minimized size both round down to the same number of rows.

As an example on my system, using device pixels, the original panel height was 1857, which allowed for 50 rows with a 37 pixel cell height. The minimized height was 1841, which only allowed for 49 rows. It was that difference in row count that caused it to scroll up a line.

But after adjusting the padding, I was able to get the base height down to 1846, which results in a minimized height of 1830. Since both of those can fit 49 rows with a 37 pixel cell height, there is no longer a change in row count when minimizing and maximizing, so it doesn't trigger a scroll.

The amount of padding you need to add will obviously depend on your screen size and font size, but if you're desperate enough to fix the issue, you can just keep adjusting the padding 1 pixel at a time until it eventually works (hopefully).

@j4james commented on GitHub (Apr 6, 2024): This has been annoying me recently, so I tried to find out what was causing the issue, and it looks to me like it might be the XAML framework that is giving us the wrong size. When I minimize the terminal, I receive a height in the `ControlCore::SizeChanged` handler that is 8 pixels smaller than what it should be (this translates to 16 device pixels, since my display scaling is 200%). I don't know if this is something we can fix, but as a workaround, I've discovered that you can prevent it from triggering a scroll just by tweaking the window padding. The idea is to adjust the available height so that the maximized size and minimized size both round down to the same number of rows. As an example on my system, using device pixels, the original panel height was 1857, which allowed for 50 rows with a 37 pixel cell height. The minimized height was 1841, which only allowed for 49 rows. It was that difference in row count that caused it to scroll up a line. But after adjusting the padding, I was able to get the base height down to 1846, which results in a minimized height of 1830. Since both of those can fit 49 rows with a 37 pixel cell height, there is no longer a change in row count when minimizing and maximizing, so it doesn't trigger a scroll. The amount of padding you need to add will obviously depend on your screen size and font size, but if you're desperate enough to fix the issue, you can just keep adjusting the padding 1 pixel at a time until it eventually works (hopefully).
Author
Owner

@tusharsnx commented on GitHub (Apr 9, 2024):

size-change-maximized-minimized

Under Minimized state, we go into Window mode styling that adds extra padding at the top.

@tusharsnx commented on GitHub (Apr 9, 2024): ![size-change-maximized-minimized](https://github.com/microsoft/terminal/assets/55626797/019ca689-8960-49b1-9675-4cfe0af14fd0) Under Minimized state, we go into Window mode styling that adds extra padding at the top.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18419