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
Fix DBCS attribute corruption during reflow #12853
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2297,8 +2297,6 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer, | |
// the "right" boundary, which is one past the final valid | ||
// character) | ||
short iOldCol = 0; | ||
auto chars{ row.GetCharRow().cbegin() }; | ||
auto attrs{ row.GetAttrRow().begin() }; | ||
const auto copyRight = iRight; | ||
for (; iOldCol < copyRight; iOldCol++) | ||
{ | ||
|
@@ -2311,9 +2309,9 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer, | |
try | ||
{ | ||
// TODO: MSFT: 19446208 - this should just use an iterator and the inserter... | ||
const auto glyph = chars->Char(); | ||
const auto dbcsAttr = chars->DbcsAttr(); | ||
const auto textAttr = *attrs; | ||
const auto glyph = row.GetCharRow().GlyphAt(iOldCol); | ||
const auto dbcsAttr = row.GetCharRow().DbcsAttrAt(iOldCol); | ||
const auto textAttr = row.GetAttrRow().GetAttrByColumn(iOldCol); | ||
|
||
if (!newBuffer.InsertCharacter(glyph, dbcsAttr, textAttr)) | ||
{ | ||
|
@@ -2322,9 +2320,6 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer, | |
} | ||
} | ||
CATCH_RETURN(); | ||
|
||
++chars; | ||
++attrs; | ||
} | ||
|
||
// GH#32: Copy the attributes from the rest of the row into this new buffer. | ||
|
@@ -2360,16 +2355,13 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer, | |
try | ||
{ | ||
// TODO: MSFT: 19446208 - this should just use an iterator and the inserter... | ||
const auto textAttr = *attrs; | ||
const auto textAttr = row.GetAttrRow().GetAttrByColumn(copyAttrCol); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sad that this beautiful optimization had to die |
||
if (!newRow.GetAttrRow().SetAttrToEnd(newAttrColumn, textAttr)) | ||
{ | ||
break; | ||
} | ||
} | ||
CATCH_LOG(); // Not worth dying over. | ||
|
||
++newAttrColumn; | ||
lhecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
++attrs; | ||
} | ||
|
||
// If we found the old row that the caller was interested in, set the | ||
|
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.
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 cause
chars++
might skip two columns for something like an emoji, right?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.
Yeah I think so.