Skip to content
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

We've been trying to reach you about your WriteCharsLegacy's extended Emoji support #15567

Merged
6 changes: 6 additions & 0 deletions src/buffer/out/Row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ LineRendition ROW::GetLineRendition() const noexcept
return _lineRendition;
}

uint16_t ROW::GetLineWidth() const noexcept
{
const auto scale = _lineRendition != LineRendition::SingleWidth ? 1 : 0;
return _columnCount >> scale;
}

// Routine Description:
// - Sets all properties of the ROW to default values
// Arguments:
Expand Down
1 change: 1 addition & 0 deletions src/buffer/out/Row.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ROW final
bool WasDoubleBytePadded() const noexcept;
void SetLineRendition(const LineRendition lineRendition) noexcept;
LineRendition GetLineRendition() const noexcept;
uint16_t GetLineWidth() const noexcept;

void Reset(const TextAttribute& attr) noexcept;
void TransferAttributes(const til::small_rle<TextAttribute, uint16_t, 1>& attr, til::CoordType newWidth);
Expand Down
16 changes: 7 additions & 9 deletions src/buffer/out/textBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,18 +450,11 @@ void TextBuffer::ConsumeGrapheme(std::wstring_view& chars) noexcept

// This function is intended for writing regular "lines" of text as it'll set the wrap flag on the given row.
// You can continue calling the function on the same row as long as state.columnEnd < state.columnLimit.
void TextBuffer::WriteLine(til::CoordType row, bool wrapAtEOL, const TextAttribute& attributes, RowWriteState& state)
void TextBuffer::Write(til::CoordType row, const TextAttribute& attributes, RowWriteState& state)
{
auto& r = GetRowByOffset(row);

r.ReplaceText(state);
r.ReplaceAttributes(state.columnBegin, state.columnEnd, attributes);

if (state.columnEnd >= state.columnLimit)
{
r.SetWrapForced(wrapAtEOL);
}

TriggerRedraw(Viewport::FromExclusive({ state.columnBeginDirty, row, state.columnEndDirty, row + 1 }));
}

Expand Down Expand Up @@ -946,7 +939,7 @@ const Cursor& TextBuffer::GetCursor() const noexcept
return _cursor;
}

[[nodiscard]] TextAttribute TextBuffer::GetCurrentAttributes() const noexcept
const TextAttribute& TextBuffer::GetCurrentAttributes() const noexcept
{
return _currentAttributes;
}
Expand All @@ -956,6 +949,11 @@ void TextBuffer::SetCurrentAttributes(const TextAttribute& currentAttributes) no
_currentAttributes = currentAttributes;
}

void TextBuffer::SetWrapForced(const til::CoordType y, bool wrap)
{
GetRowByOffset(y).SetWrapForced(wrap);
}

void TextBuffer::SetCurrentLineRendition(const LineRendition lineRendition, const TextAttribute& fillAttributes)
{
const auto cursorPosition = GetCursor().GetPosition();
Expand Down
5 changes: 3 additions & 2 deletions src/buffer/out/textBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class TextBuffer final

// Text insertion functions
static void ConsumeGrapheme(std::wstring_view& chars) noexcept;
void WriteLine(til::CoordType row, bool wrapAtEOL, const TextAttribute& attributes, RowWriteState& state);
void Write(til::CoordType row, const TextAttribute& attributes, RowWriteState& state);
void FillRect(const til::rect& rect, const std::wstring_view& fill, const TextAttribute& attributes);

OutputCellIterator Write(const OutputCellIterator givenIt);
Expand Down Expand Up @@ -133,10 +133,11 @@ class TextBuffer final

til::CoordType TotalRowCount() const noexcept;

[[nodiscard]] TextAttribute GetCurrentAttributes() const noexcept;
const TextAttribute& GetCurrentAttributes() const noexcept;

void SetCurrentAttributes(const TextAttribute& currentAttributes) noexcept;

void SetWrapForced(til::CoordType y, bool wrap);
void SetCurrentLineRendition(const LineRendition lineRendition, const TextAttribute& fillAttributes);
void ResetLineRenditionRange(const til::CoordType startRow, const til::CoordType endRow);
LineRendition GetLineRendition(const til::CoordType row) const;
Expand Down
Loading
Loading