Skip to content

Commit 4d2834d

Browse files
Update Console.cc
Fix an issue with the text being blinky when using the EraseInLine() function.
1 parent 4c2d8d1 commit 4d2834d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Console/retro/Console.cc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,12 @@ void Console::ClearFromCursorToEndOfLine()
888888
std::fill(onscreen.begin() + currentPosition, onscreen.begin() + endOfLinePosition, AttributedChar(' ', currentAttr));
889889

890890
Update();
891-
Draw(bounds);
891+
892+
// Erase only on the line the cursor is on
893+
Rect rect;
894+
rect = CellRect(cursorX, cursorY);
895+
rect.right = cols * cellSizeX;
896+
EraseRect(&rect);
892897
}
893898

894899
// Erases from the beginning of the line to the cursor's position
@@ -902,7 +907,12 @@ void Console::ClearFromBeginningOfLineToCursor()
902907
std::fill(onscreen.begin() + beginningOfLinePosition, onscreen.begin() + currentPosition, AttributedChar(' ', currentAttr));
903908

904909
Update();
905-
Draw(bounds);
910+
911+
// Erase only on the line the cursor is on
912+
Rect rect;
913+
rect = CellRect(0, cursorY);
914+
rect.right = GetCursorX() * cellSizeX;
915+
EraseRect(&rect);
906916
}
907917

908918
// Erases the entire line the cursor is on
@@ -916,7 +926,12 @@ void Console::ClearEntireLine()
916926
std::fill(onscreen.begin() + beginningOfLinePosition, onscreen.begin() + endOfLinePosition, AttributedChar(' ', currentAttr));
917927

918928
Update();
919-
Draw(bounds);
929+
930+
// Erase only the line the cursor is on
931+
Rect rect;
932+
rect = CellRect(0, cursorY);
933+
rect.right = cols * cellSizeX;
934+
EraseRect(&rect);
920935
}
921936

922937
// Bound to ANSI escape code h
@@ -963,4 +978,4 @@ void Console::SetCursorY(int newY)
963978
int Console::GetCursorY()
964979
{
965980
return cursorY + 1;
966-
}
981+
}

0 commit comments

Comments
 (0)