[PR #5317] [MERGED] Update the virtual bottom location if the cursor moves below it #26246

Open
opened 2026-01-31 09:14:54 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5317
Author: @j4james
Created: 4/10/2020
Status: ✅ Merged
Merged: 4/14/2020
Merged by: @DHowett-MSFT

Base: master ← Head: fix-virtual-bottom


📝 Commits (2)

  • a2db562 Update the virtual bottom location if the cursor moves below that point.
  • 6b8fac1 Add a unit test to confirm the virtual bottom is being updated.

📊 Changes

2 files changed (+55 additions, -0 deletions)

View changed files

📝 src/host/screenInfo.cpp (+6 -0)
📝 src/host/ut_host/ScreenBufferTests.cpp (+49 -0)

📄 Description

Summary of the Pull Request

If an application writes to the screen while not in VT mode, and the user has scrolled forward in the screen buffer, the virtual bottom location is not updated to take that new content into account. As a result, the viewport can later jump back to the previous virtual bottom, making the content disappear off screen. This PR attempts to fix that issue by updating the virtual bottom location whenever the cursor moves below that point.

PR Checklist

Detailed Description of the Pull Request / Additional comments

This simply adds a condition in the SCREEN_INFORMATION::SetCursorPosition to check if the new Y coordinate is below the current virtual bottom, and if so, updates the virtual bottom to that new value.

I considered trying to make it only update when something is actually written to the screen, but this seemed like a cleaner solution, and is less likely to miss out on a needed update.

Validation Steps Performed

I've manually tested the case described in issue #5302, and confirmed that it now works as expected. I've also added a unit test that checks the virtual bottom is updated correctly under similar conditions.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/5317 **Author:** [@j4james](https://github.com/j4james) **Created:** 4/10/2020 **Status:** ✅ Merged **Merged:** 4/14/2020 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `fix-virtual-bottom` --- ### 📝 Commits (2) - [`a2db562`](https://github.com/microsoft/terminal/commit/a2db562cfef94c5d86ebb4d9d5bbd207f37e4e16) Update the virtual bottom location if the cursor moves below that point. - [`6b8fac1`](https://github.com/microsoft/terminal/commit/6b8fac1725b37515da6e5752cfcdbf7a9ed84a39) Add a unit test to confirm the virtual bottom is being updated. ### 📊 Changes **2 files changed** (+55 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/host/screenInfo.cpp` (+6 -0) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+49 -0) </details> ### 📄 Description ## Summary of the Pull Request If an application writes to the screen while not in VT mode, and the user has scrolled forward in the screen buffer, the _virtual bottom_ location is not updated to take that new content into account. As a result, the viewport can later jump back to the previous _virtual bottom_, making the content disappear off screen. This PR attempts to fix that issue by updating the _virtual bottom_ location whenever the cursor moves below that point. ## PR Checklist * [x] Closes #5302 * [x] CLA signed. * [x] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've haven't discussed this with core contributors already. I'm ready to accept this work might be rejected in favor of a different grand plan. ## Detailed Description of the Pull Request / Additional comments This simply adds a condition in the `SCREEN_INFORMATION::SetCursorPosition` to check if the new _Y_ coordinate is below the current _virtual bottom_, and if so, updates the _virtual bottom_ to that new value. I considered trying to make it only update when something is actually written to the screen, but this seemed like a cleaner solution, and is less likely to miss out on a needed update. ## Validation Steps Performed I've manually tested the case described in issue #5302, and confirmed that it now works as expected. I've also added a unit test that checks the virtual bottom is updated correctly under similar conditions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:14:54 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26246