Skip to content

Commit

Permalink
update for merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Apr 20, 2021
1 parent 46d6d68 commit c3f9d36
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
// old buffer's.
const auto oldBufferAttributes = _buffer->GetCurrentAttributes();
newTextBuffer = std::make_unique<TextBuffer>(bufferSize,
TextAttribute(),
TextAttribute{},
0, // temporarily set size to 0 so it won't render.
_buffer->GetRenderTarget());

Expand Down Expand Up @@ -281,7 +281,7 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
newViewportTop = oldRows.mutableViewportTop;
newVisibleTop = oldRows.visibleViewportTop;

// Restore the actve text attributes
// Restore the active text attributes
newTextBuffer->SetCurrentAttributes(oldBufferAttributes);
}
CATCH_RETURN();
Expand Down
14 changes: 9 additions & 5 deletions src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final

TEST_METHOD(HyperlinkIdConsistency);

TEST_METHOD(ResizeInitializeBufferWithDefaultAttrs);

private:
bool _writeCallback(const char* const pch, size_t const cch);
void _flushFirstFrame();
Expand Down Expand Up @@ -2900,11 +2902,13 @@ void ConptyRoundtripTests::ResizeInitializeBufferWithDefaultAttrs()
auto conhostGreenAttrs = TextAttribute();

// Conhost and Terminal store attributes in different bits.
conhostGreenAttrs.SetIndexedAttributes(std::nullopt,
{ static_cast<BYTE>(FOREGROUND_GREEN) });
// conhostGreenAttrs.SetIndexedAttributes(std::nullopt,
// { static_cast<BYTE>(FOREGROUND_GREEN) });
conhostGreenAttrs.SetIndexedBackground(FOREGROUND_GREEN);
auto terminalGreenAttrs = TextAttribute();
terminalGreenAttrs.SetIndexedAttributes(std::nullopt,
{ static_cast<BYTE>(XTERM_GREEN_ATTR) });
// terminalGreenAttrs.SetIndexedAttributes(std::nullopt,
// { static_cast<BYTE>(XTERM_GREEN_ATTR) });
terminalGreenAttrs.SetIndexedBackground(XTERM_GREEN_ATTR);

const size_t width = static_cast<size_t>(TerminalViewWidth);

Expand Down Expand Up @@ -2946,7 +2950,7 @@ void ConptyRoundtripTests::ResizeInitializeBufferWithDefaultAttrs()
{
Log::Comment(NoThrowString().Format(L"Checking row %d...", row));

VERIFY_IS_FALSE(tb.GetRowByOffset(row).GetCharRow().WasWrapForced());
VERIFY_IS_FALSE(tb.GetRowByOffset(row).WasWrapForced());

const bool hasChar = row < 3;
const auto actualDefaultAttrs = isTerminal ? TextAttribute() : defaultAttrs;
Expand Down
3 changes: 1 addition & 2 deletions src/host/screenInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,6 @@ bool SCREEN_INFORMATION::IsMaximizedY() const
RIPMSG2(RIP_WARNING, "Invalid screen buffer size (0x%x, 0x%x)", coordNewScreenSize.X, coordNewScreenSize.Y);
return STATUS_INVALID_PARAMETER;
}
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();

// First allocate a new text buffer to take the place of the current one.
std::unique_ptr<TextBuffer> newTextBuffer;
Expand All @@ -1422,7 +1421,7 @@ bool SCREEN_INFORMATION::IsMaximizedY() const
try
{
newTextBuffer = std::make_unique<TextBuffer>(coordNewScreenSize,
gci.GetDefaultAttributes(),
TextAttribute{},
0,
_renderTarget); // temporarily set size to 0 so it won't render.
}
Expand Down

0 comments on commit c3f9d36

Please sign in to comment.