Cursor+Scrollbar glitch #7835

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

Originally created by @AnuthaDev on GitHub (Apr 30, 2020).

Environment

Windows build number: 10.0.18363.720
Windows Terminal version (if applicable): 0.11.1191.0

Any other software?
No

Steps to reproduce

  1. Open terminal
  2. Resize window height to minimum.
  3. Increase windows height.

Expected behavior

No scrollbar, The cursor line does not become topmost on entering input:
withoutscroll

Actual behavior

Scrollbar is visible and the line with cursor moves to top on typing:

scrollbottom~2

withscrol~2

Originally created by @AnuthaDev on GitHub (Apr 30, 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.18363.720 Windows Terminal version (if applicable): 0.11.1191.0 Any other software? No ``` # Steps to reproduce 1. Open terminal 2. Resize window height to minimum. 3. Increase windows height. # Expected behavior No scrollbar, The cursor line does not become topmost on entering input: ![withoutscroll](https://user-images.githubusercontent.com/36439704/80711766-84151a80-8b0e-11ea-8de8-5ba794b7565b.png) # Actual behavior Scrollbar is visible and the line with cursor moves to top on typing: ![scrollbottom~2](https://user-images.githubusercontent.com/36439704/80712206-3f3db380-8b0f-11ea-98eb-3b07eb7c5c5a.png) ![withscrol~2](https://user-images.githubusercontent.com/36439704/80711990-e241fd80-8b0e-11ea-8474-b4f921c62b65.png)
Author
Owner

@zadjii-msft commented on GitHub (Apr 30, 2020):

So this is an unfortunate side-effect of how the Terminal works. There's essentially a hidden console buffer that the Terminal is rendering, and that buffer is only ever as big as the viewport of the Terminal. So when you decrease the height of the terminal, that text buffer decreases in height as well. That buffer and the Terminal buffer have to stay in sync so that the Terminal won't display any sort of visual corruption, so when the Terminal is resized down to 1 line, the Terminal moves the rest of the buffer content into the history, so it can preserve the contents of the buffer, while still staying in sync with the conpty buffer.

There's an enormous amount of details in #4200, #4741, and #3490. I'd look at those threads more if you want a more detailed explanation of why this path was chosen.

I considered the possibility of having the terminal have a "virtual viewport" that doesn't move on the resize. Then when you resize, our mutable viewport would stay in sync with the conpty viewport, but the "virtual viewport" would stay in the same logical place as before the resize. This however seemed like a bad idea:

  • We've already got experimental support for a virtual viewport in conhost, and that led to a giant pile of bugs, and I'd rather not repeat the same mistakes in the Terminal.
  • When someone uses a VT sequence to move the cursor to a particular location in the buffer, the location that would be used is the mutable viewport's position, not the virtual viewport's. It's possible that this might work out alright and might not be too confusing, but on paper it certainly sounds like it'll be extra confusing.
@zadjii-msft commented on GitHub (Apr 30, 2020): So this is an unfortunate side-effect of how the Terminal works. There's essentially a hidden console buffer that the Terminal is rendering, and that buffer is only ever as big as the viewport of the Terminal. So when you decrease the height of the terminal, that text buffer decreases in height as well. That buffer and the Terminal buffer have to stay in sync so that the Terminal won't display any sort of visual corruption, so when the Terminal is resized down to 1 line, the Terminal moves the rest of the buffer content into the history, so it can preserve the contents of the buffer, while still staying in sync with the conpty buffer. There's an enormous amount of details in #4200, #4741, and #3490. I'd look at those threads more if you want a more detailed explanation of why this path was chosen. I considered the possibility of having the terminal have a "virtual viewport" that _doesn't_ move on the resize. Then when you resize, our mutable viewport would stay in sync with the conpty viewport, but the "virtual viewport" would stay in the same logical place as before the resize. This however seemed like a bad idea: * We've already got experimental support for a virtual viewport in conhost, and that led to a giant pile of bugs, and I'd rather not repeat the same mistakes in the Terminal. * When someone uses a VT sequence to move the cursor to a particular location in the buffer, the location that would be used is the _mutable_ viewport's position, not the _virtual_ viewport's. It's possible that this might work out alright and might not be too confusing, but on paper it certainly sounds like it'll be extra confusing.
Author
Owner

@AnuthaDev commented on GitHub (Apr 30, 2020):

My head hurts only reading about all this, this stuff is way above my level. Anyways, thanks @zadjii-msft . Maybe I will try to fix it someday.... maybe😅

@AnuthaDev commented on GitHub (Apr 30, 2020): My head hurts only reading about all this, this stuff is way above my level. Anyways, thanks @zadjii-msft . Maybe I will try to fix it someday.... maybe😅
Author
Owner

@zadjii-msft commented on GitHub (Apr 30, 2020):

My head hurts only reading about all this

You have no idea - this was like 3 months of my life 😆

@zadjii-msft commented on GitHub (Apr 30, 2020): > My head hurts only reading about all this You have no idea - this was like 3 months of my life 😆
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7835