Skip to content

Commit 75f00ee

Browse files
authored
fix(cli): Make --watcher CLEAR_SCREEN clear scrollback buffer as well as visible screen (denoland#25997)
The --watch option should clear the screen scrollback buffer as well as the screen itself. On Ubuntu (22.04 Jammy) the 'clear' command generates "\x1B[H\x1B[2J\x1B[3J"; that is: - \E[H - cursor home - \E[2J - clear entire screen - \E[3J - clear entire screen & scrollback buffer. By contrast, Deno defined CLEAR_SCREEN as "\x1B[2J\x1B[1;1H", which fails to clear the scrollback buffer. The "\E[H\E[2J\E[3J" sequence works on MacOS (Sonoma) (using printf); I'm not able to test on Windows. Closes denoland#26514
1 parent 793b155 commit 75f00ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli/util/file_watcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use tokio::sync::mpsc;
3030
use tokio::sync::mpsc::UnboundedReceiver;
3131
use tokio::time::sleep;
3232

33-
const CLEAR_SCREEN: &str = "\x1B[2J\x1B[1;1H";
33+
const CLEAR_SCREEN: &str = "\x1B[H\x1B[2J\x1B[3J";
3434
const DEBOUNCE_INTERVAL: Duration = Duration::from_millis(200);
3535

3636
struct DebouncedReceiver {

0 commit comments

Comments
 (0)