Skip to content

Commit

Permalink
Revert "Properly fix ConPTY buffer corking (#16793)"
Browse files Browse the repository at this point in the history
This reverts commit 275e8d1.
  • Loading branch information
DHowett committed Apr 30, 2024
1 parent 743d568 commit 164df3c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
4 changes: 0 additions & 4 deletions src/renderer/vt/invalidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ CATCH_RETURN();
// end paint to specifically handle this.
_circled = circled;

// If we flushed for any reason other than circling (i.e, a sequence that we
// didn't understand), we don't need to push the buffer out on EndPaint.
_noFlushOnEnd = !circled;

_trace.TraceTriggerCircling(*pForcePaint);
return S_OK;
}
Expand Down
14 changes: 1 addition & 13 deletions src/renderer/vt/paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,7 @@ using namespace Microsoft::Console::Types;
RETURN_IF_FAILED(_MoveCursor(_deferredCursorPos));
}

// If this frame was triggered because we encountered a VT sequence which
// required the buffered state to get printed, we don't want to flush this
// frame to the pipe. That might result in us rendering half the output of a
// particular frame (as emitted by the client).
//
// Instead, we'll leave this frame in _buffer, and just keep appending to
// it as needed.
if (!_noFlushOnEnd)
{
_Flush();
}

_noFlushOnEnd = false;
_Flush();
return S_OK;
}

Expand Down
19 changes: 2 additions & 17 deletions src/renderer/vt/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,10 @@ CATCH_RETURN();

void VtEngine::_Flush() noexcept
{
if (_buffer.empty())
{
return;
}

if (!_corked)
if (!_corked && !_buffer.empty())
{
_flushImpl();
return;
}

// Defer the flush until someone calls Cork(false).
_flushRequested = true;
}

// _corked is often true and separating _flushImpl() out allows _flush() to be inlined.
Expand Down Expand Up @@ -176,13 +167,7 @@ void VtEngine::_flushImpl() noexcept
void VtEngine::Cork(bool corked) noexcept
{
_corked = corked;

// Now do the deferred flush from a previous call to _Flush().
if (!corked && _flushRequested)
{
_flushRequested = false;
_flushImpl();
}
_Flush();
}

// Method Description:
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/vt/vtrenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ namespace Microsoft::Console::Render

bool _resizeQuirk{ false };
bool _passthrough{ false };
bool _noFlushOnEnd{ false };
bool _corked{ false };
bool _flushRequested{ false };
std::optional<TextColor> _newBottomLineBG{ std::nullopt };

[[nodiscard]] HRESULT _WriteFill(const size_t n, const char c) noexcept;
Expand Down

0 comments on commit 164df3c

Please sign in to comment.