Update Console.cc

Fix an issue with the text being blinky when using the EraseInLine() function.
This commit is contained in:
programmingkidx
2025-04-25 10:45:59 -04:00
committed by GitHub
parent 4c2d8d1b51
commit 4d2834db60
+19 -4
View File
@@ -888,7 +888,12 @@ void Console::ClearFromCursorToEndOfLine()
std::fill(onscreen.begin() + currentPosition, onscreen.begin() + endOfLinePosition, AttributedChar(' ', currentAttr));
Update();
Draw(bounds);
// Erase only on the line the cursor is on
Rect rect;
rect = CellRect(cursorX, cursorY);
rect.right = cols * cellSizeX;
EraseRect(&rect);
}
// Erases from the beginning of the line to the cursor's position
@@ -902,7 +907,12 @@ void Console::ClearFromBeginningOfLineToCursor()
std::fill(onscreen.begin() + beginningOfLinePosition, onscreen.begin() + currentPosition, AttributedChar(' ', currentAttr));
Update();
Draw(bounds);
// Erase only on the line the cursor is on
Rect rect;
rect = CellRect(0, cursorY);
rect.right = GetCursorX() * cellSizeX;
EraseRect(&rect);
}
// Erases the entire line the cursor is on
@@ -916,7 +926,12 @@ void Console::ClearEntireLine()
std::fill(onscreen.begin() + beginningOfLinePosition, onscreen.begin() + endOfLinePosition, AttributedChar(' ', currentAttr));
Update();
Draw(bounds);
// Erase only the line the cursor is on
Rect rect;
rect = CellRect(0, cursorY);
rect.right = cols * cellSizeX;
EraseRect(&rect);
}
// Bound to ANSI escape code h
@@ -963,4 +978,4 @@ void Console::SetCursorY(int newY)
int Console::GetCursorY()
{
return cursorY + 1;
}
}