-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move AdaptDispatch::_FillRect into TextBuffer #15541
Conversation
e4f75bb
to
fbbc632
Compare
@msftbot make sure @j4james signs off 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very happy to have full Unicode support in DECFRA
, but I'm just concerned about the possible loss of accessibility in ConHost, and the need for clamping in the REP
escape sequence.
55e8118
to
04e7f59
Compare
I see your rename, but I am a bit worried that the title buries the lede a bit ;) |
Do you feel like the TextBuffer change is more significant? Would you like me to extract it out? |
I'd suggest something like, "Lift |
I've shortened it a bit, so it better fits the column limit. |
Technically true, but disappointing. 😿 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only really reviewed the AdaptDispatch
code, but I've also built it locally and done some manual testing, and it looks good to me.
@@ -3211,6 +3198,7 @@ bool AdaptDispatch::_EraseAll() | |||
} | |||
_api.NotifyBufferRotation(delta); | |||
newViewportTop -= delta; | |||
newViewportBottom -= delta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, we didn't do this before, but this seems right. Any idea if this fixes some bug or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes I forgot to mention this. Thanks for pointing it out. It's not really a bug per se, but the old code relied on TextBuffer::WriteLine
discarding any writes that are out of bounds. The new TextBuffer::FillRect
on the other hand will not check if the given rectangle is in the bounds of the buffer and so if you give it an address like 310 in a 300-row buffer it'll fill row 10. This change fixes the issue.
Yeah. 😢 But we got the tech now to do it at least. 😅 I didn't feel comfortable making the change to the |
#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 ✅
#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 commit makes 2 changes:
ROW::CopyTextFrom
This will allow us to call
TriggerRedraw
, which is an aspectI haven't previously considered as something this API needs.
FillRect
API toTextBuffer
and refactorAdeptDispatch
to use that API. Even if we determine that the new text APIs are
unfit (for instance too difficult to use), this will make it simpler
to write efficient implementations right inside
TextBuffer
.Since the new
FillRect
API lacks bounds checks the wayWriteLine
has them, it breaks
AdaptDispatch::_EraseAll
which failed to adjustthe bottom parameter after scrolling the contents. This would result
in more rows being erased than intended.
Validation Steps Performed
chcp 65001
pwsh
"`e[29483`$x"
fills the viewport with cats ✅ResizeTraditional
still doesn't work any worse than it used to ✅