-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent horizontally scrolling wide chars erasing themselves (#14650)
When the buffer contains wide characters that occupy more than one cell, and those cells are scrolled horizontally by exactly one column, that operation can result in the wide characters being completely erased. This PR attempts to fix that bug, although it's not an ideal long term solution. Although not really to blame, it was PR #13626 that exposed this issue. The root of the problem is that scrolling operations copy cells one by one, but wide characters are written to the buffer two cells at a time. So when you move a wide character one position to the left or right, it can overwrite itself before it's finished copying, and the end result is the whole character gets erased. I've attempt to solve this by getting the affected operations to read two cells in advance before they start writing, so there's no risk of losing the source data before it's fully output. This may not work in the long term, with characters wider than two cells, but it should at least be good enough for now. I've also changed the `TextBuffer::Write` call to a `WriteLine` call to improve the handling of a wide character on the end of the line, where moving it right by one column would place it half off screen. It should just be dropped, but with the `Write` method, it would end up pushed onto the following line. ## Validation Steps Performed I've manually confirmed this fixes all the test cases described in #14626, and also added some unit tests that replicate those scenarios. Closes #14626
- Loading branch information
Showing
3 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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