microsoft / microsoft/terminal
ResizeWithReflow doesn't clamp _virtualBottom if the cursor is above the viewport
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
Windows Terminal version
1a6ba43
Windows build number
No response
Other Software
No response
Steps to reproduce
TBA: Exact steps unclear, but it was found by @zadjii-msft in #16937 as part of reflow tests.
However, repro steps aren't quite necessary as the flaw can be clearly seen here:
https://github.com/microsoft/terminal/blob/1a6ba43dd220d4a318627006bf2a6c8b9a70c7bc/src/host/screenInfo.cpp#L1404-L1407
There's no min(). (Alternatively, you can just patch Reflow() to put the cursor at 0,0 after a reflow.)
Terminal::UserResize doesn't use its newCursorPos either.
Expected Behavior
No response
Actual Behavior
The viewport should always contain the cursor, even if the cursor is above the viewport.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/host/screenInfo.cpp at the linked lines around Reflow(), and inspect how _virtualBottom and the cursor position are handled when the cursor is above the viewport. Also check Terminal::UserResize and its unused newCursorPos. Done means reflow and resize keep the viewport containing the cursor, including when the cursor starts above it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100