From 7dbefe06e41f191a0e83cfefe4896b66094c4089 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Sun, 8 Dec 2019 19:17:58 +0000 Subject: [PATCH] Make sure the "delay EOL wrap" behaviour is only applied when the ENABLE_WRAP_AT_EOL_OUTPUT mode is set. --- src/host/_stream.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/host/_stream.cpp b/src/host/_stream.cpp index 363eb4427ad7..9925c41150a5 100644 --- a/src/host/_stream.cpp +++ b/src/host/_stream.cpp @@ -308,6 +308,7 @@ constexpr unsigned int LOCAL_BUFFER_SIZE = 100; WCHAR LocalBuffer[LOCAL_BUFFER_SIZE]; size_t TempNumSpaces = 0; const bool fUnprocessed = WI_IsFlagClear(screenInfo.OutputMode, ENABLE_PROCESSED_OUTPUT); + const bool fWrapAtEOL = WI_IsFlagSet(screenInfo.OutputMode, ENABLE_WRAP_AT_EOL_OUTPUT); // Must not adjust cursor here. It has to stay on for many write scenarios. Consumers should call for the // cursor to be turned off if they want that. @@ -323,7 +324,7 @@ constexpr unsigned int LOCAL_BUFFER_SIZE = 100; while (*pcb < BufferSize) { // correct for delayed EOL - if (cursor.IsDelayedEOLWrap()) + if (cursor.IsDelayedEOLWrap() && fWrapAtEOL) { const COORD coordDelayedAt = cursor.GetDelayedAtPosition(); cursor.ResetDelayEOLWrap(); @@ -561,7 +562,7 @@ constexpr unsigned int LOCAL_BUFFER_SIZE = 100; CursorPosition.X = XPosition; // enforce a delayed newline if we're about to pass the end and the WC_DELAY_EOL_WRAP flag is set. - if (WI_IsFlagSet(dwFlags, WC_DELAY_EOL_WRAP) && CursorPosition.X >= coordScreenBufferSize.X) + if (WI_IsFlagSet(dwFlags, WC_DELAY_EOL_WRAP) && CursorPosition.X >= coordScreenBufferSize.X && fWrapAtEOL) { // Our cursor position as of this time is going to remain on the last position in this column. CursorPosition.X = coordScreenBufferSize.X - 1; @@ -730,7 +731,7 @@ constexpr unsigned int LOCAL_BUFFER_SIZE = 100; } CATCH_LOG(); } - if (cursor.GetPosition().X == 0 && (screenInfo.OutputMode & ENABLE_WRAP_AT_EOL_OUTPUT) && pwchBuffer > pwchBufferBackupLimit) + if (cursor.GetPosition().X == 0 && fWrapAtEOL && pwchBuffer > pwchBufferBackupLimit) { if (CheckBisectProcessW(screenInfo, pwchBufferBackupLimit, @@ -842,7 +843,7 @@ constexpr unsigned int LOCAL_BUFFER_SIZE = 100; if (Char >= UNICODE_SPACE && IsGlyphFullWidth(Char) && XPosition >= (coordScreenBufferSize.X - 1) && - (screenInfo.OutputMode & ENABLE_WRAP_AT_EOL_OUTPUT)) + fWrapAtEOL) { const COORD TargetPoint = cursor.GetPosition(); ROW& Row = textBuffer.GetRowByOffset(TargetPoint.Y);