Fixes #4449. Regression in IsLegacyConsole mode where dirty cells are not handled correctly (#4451)

* Fixes #4449. Regression in IsLegacyConsole mode where dirty cells are not handled correctly

* Cursor position is always set in the beginning a new row or on non-dirty flags
This commit is contained in:
BDisp
2025-12-06 16:09:52 +00:00
committed by GitHub
parent d303943809
commit 5e3175cd9d
2 changed files with 3 additions and 19 deletions

View File

@@ -67,22 +67,6 @@ public abstract class OutputBase
Attribute? redrawAttr = null;
int lastCol = -1;
if (IsLegacyConsole)
{
// BUGBUG: This is a workaround for some regression in legacy console mode where
// BUGBUG: dirty cells are not handled correctly. Mark all cells dirty as a workaround.
lock (buffer.Contents!)
{
for (var row = 0; row < buffer.Rows; row++)
{
for (var c = 0; c < buffer.Cols; c++)
{
buffer.Contents [row, c].IsDirty = true;
}
}
}
}
SetCursorVisibility (CursorVisibility.Invisible);
for (int row = top; row < rows; row++)
@@ -117,6 +101,8 @@ public abstract class OutputBase
lastCol++;
}
SetCursorPositionImpl (lastCol, row);
continue;
}
@@ -296,8 +282,6 @@ public abstract class OutputBase
private void WriteToConsole (StringBuilder output, ref int lastCol, int row, ref int outputWidth)
{
SetCursorPositionImpl (lastCol, row);
if (IsLegacyConsole)
{
Write (output);

View File

@@ -151,7 +151,7 @@ public class OutputBaseTests
Assert.False (buffer.Contents! [0, 2].IsDirty);
// Verify SetCursorPositionImpl was invoked by WriteToConsole (cursor set to a written column)
Assert.Equal (new Point (0, 0), output.GetCursorPosition ());
Assert.Equal (new Point (2, 0), output.GetCursorPosition ());
}
[Theory]