Skip to content

Commit 510c8e7

Browse files
committed
fix: remove use of non-existent write_code function
1 parent 231ef99 commit 510c8e7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/_pyrepl/windows_console.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def __init__(self, err: int | None, descr: str | None = None) -> None:
112112
MOVE_UP = "\x1b[{}A"
113113
MOVE_DOWN = "\x1b[{}B"
114114
CLEAR = "\x1b[H\x1b[J"
115+
CLEAR_ALL= "\x1b[3J\x1b[2J\x1b[H"
115116

116117
# State of control keys: https://learn.microsoft.com/en-us/windows/console/key-event-record-str
117118
ALT_ACTIVE = 0x01 | 0x02
@@ -524,9 +525,7 @@ def clear(self) -> None:
524525

525526
def clear_all(self) -> None:
526527
"""Clear screen and scrollback buffer."""
527-
os.system("cls") # This might not clear scrollback
528-
# Fallback to ANSI escape sequences if terminal supports them
529-
self.write_code("\033[3J\033[2J\033[H")
528+
self.__write(CLEAR_ALL)
530529
self.clear()
531530

532531
def finish(self) -> None:

0 commit comments

Comments
 (0)