Skip to content

Commit

Permalink
I think this is a fix for #32
Browse files Browse the repository at this point in the history
  bunch of todos. It also totally takes care of #12567 as well
  • Loading branch information
zadjii-msft committed Mar 2, 2022
1 parent 00113e3 commit 1f6210d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/buffer/out/textBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,8 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
// Loop through every character in the current row (up to
// the "right" boundary, which is one past the final valid
// character)
for (short iOldCol = 0; iOldCol < iRight; iOldCol++)
short iOldCol = 0;
for (; iOldCol < iRight; iOldCol++)
{
if (iOldCol == cOldCursorPos.X && iOldRow == cOldCursorPos.Y)
{
Expand All @@ -2265,6 +2266,31 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
CATCH_RETURN();
}

// GH#32: Copy the attributes from the rest of the row into this new buffer.
// - if the new buffer is smaller,
// * ~If we wrapped onto the line below, then we'll continue copying attributes from the original row onto the then we'll only copy the attributes TODO THIS IS WRONG~
//
// - if the
const auto minWidth = std::min(oldBuffer.GetSize().Width(), newBuffer.GetSize().Width());
auto newAttrColumn = newCursor.GetPosition().X;
for (short copyAttrCol = iOldCol; copyAttrCol < minWidth; copyAttrCol++)
{
try
{
// TODO: MSFT: 19446208 - this should just use an iterator and the inserter...
const auto textAttr = row.GetAttrRow().GetAttrByColumn(copyAttrCol);
auto& newRow = newBuffer.GetRowByOffset(newCursor.GetPosition().Y);
if (!newRow.GetAttrRow().SetAttrToEnd(newAttrColumn, textAttr))
{
// hr = E_OUTOFMEMORY;
break;
}
}
CATCH_LOG(); // TODO! Clearly I've got some condidtional wrong here. Just logging seems to make it work though. That's obviously wrong.
newAttrColumn++;
}
// TODO! Maybe also try to leave a default-attributes-to-the-end attr here, for the case where the line had color, then flowed onto the subsequent row.

// If we found the old row that the caller was interested in, set the
// out value of that parameter to the cursor's current Y position (the
// new location of the _end_ of that row in the buffer).
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/TerminalDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,4 @@ bool TerminalDispatch::HardReset()

return true;
}
git grep - z - l Microsoft.UI.Xaml | xargs - 0 sed - i - e 's/2.4.0-prerelease.200506002/2.5.0-prerelease.200812002/g'

0 comments on commit 1f6210d

Please sign in to comment.