Reset _wrapForced when erasing scrollback#16610
Merged
Conversation
j4james
reviewed
Jan 27, 2024
Member
|
(FWIW, the class name is "Adapt"Dispatch :)) |
DHowett
approved these changes
Jan 29, 2024
| // The start parameter is relative to the _firstRow. The trick to get the content to the absolute start | ||
| // is to simply add _firstRow ourselves and then reset it to 0. This causes ScrollRows() to write into | ||
| // the absolute start while reading from relative coordinates. This works because GetRowByOffset() | ||
| // operates modulo the buffer height and so the possibly-too-large startAbsolute won't be an issue. |
Member
Author
There was a problem hiding this comment.
Yeah... Alternative approaches aren't particularly nice either unfortunately, hence the big comment. But I believe this will remain the only function that would need such a trick, so the impact is at least limited. 😅
zadjii-msft
approved these changes
Jan 29, 2024
Member
zadjii-msft
left a comment
There was a problem hiding this comment.
okay I think I follow. Kinda surprised that a test didn't catch this?
DHowett
pushed a commit
that referenced
this pull request
Jan 29, 2024
#15541 changed `AdaptDispatch::_FillRect` which caused it to not affect the `ROW::_wrapForced` flag anymore. This change in behavior was not noticeable as `TextBuffer::GetLastNonSpaceCharacter` had a bug where rows of only whitespace text would always be treated as empty. This would then affect `AdaptDispatch::_EraseAll` to accidentally correctly guess the last row with text despite the `_FillRect` change. #15701 then fixed `GetLastNonSpaceCharacter` indirectly by fixing `ROW::MeasureRight` which now made the previous change apparent. `_EraseAll` would now guess the last row of text incorrectly, because it would find the rows that `_FillRect` cleared but still had `_wrapForced` set to `true`. This PR fixes the issue by replacing the `_FillRect` usage to clear rows with direct calls to `ROW::Reset()`. In the future this could be extended by also `MEM_DECOMMIT`ing the now unused underlying memory. Closes #16603 ## Validation Steps Performed * Enter WSL and resize the window to <40 columns * Execute ```sh cd /bin ls -la printf "\e[3J" ls -la printf "\e[3J" printf "\e[2J" ``` * Only one viewport-height-many lines of whitespace exist between the current prompt line and the previous scrollback contents ✅ (cherry picked from commit 5f71cf3) Service-Card-Id: 91707937 Service-Version: 1.19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#15541 changed
AdaptDispatch::_FillRectwhich caused it to not affectthe
ROW::_wrapForcedflag anymore. This change in behavior was notnoticeable as
TextBuffer::GetLastNonSpaceCharacterhad a bug whererows of only whitespace text would always be treated as empty.
This would then affect
AdaptDispatch::_EraseAllto accidentallycorrectly guess the last row with text despite the
_FillRectchange.#15701 then fixed
GetLastNonSpaceCharacterindirectly by fixingROW::MeasureRightwhich now made the previous change apparent._EraseAllwould now guess the last row of text incorrectly,because it would find the rows that
_FillRectcleared but stillhad
_wrapForcedset totrue.This PR fixes the issue by replacing the
_FillRectusage to clearrows with direct calls to
ROW::Reset(). In the future this could beextended by also
MEM_DECOMMITing the now unused underlying memory.Closes #16603
Validation Steps Performed
current prompt line and the previous scrollback contents ✅