From 28755990990dd177f978e67ca6fefaee48d19a52 Mon Sep 17 00:00:00 2001 From: Samuel Nelson Date: Wed, 5 Jun 2024 15:18:26 +1200 Subject: [PATCH] Revert "fix: erase scrollback when clearing the screen (#2267)" This reverts commit 00b715a0c31624bc0c8b78247d60c75db47eae36. --- frontend/src/main/scala/bloop/engine/Interpreter.scala | 2 +- frontend/src/main/scala/bloop/io/SourceWatcher.scala | 2 +- frontend/src/main/scala/bloop/util/Console.scala | 10 ---------- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 frontend/src/main/scala/bloop/util/Console.scala diff --git a/frontend/src/main/scala/bloop/engine/Interpreter.scala b/frontend/src/main/scala/bloop/engine/Interpreter.scala index c4a32e8e18..e1d68d2015 100644 --- a/frontend/src/main/scala/bloop/engine/Interpreter.scala +++ b/frontend/src/main/scala/bloop/engine/Interpreter.scala @@ -139,7 +139,7 @@ object Interpreter { } if (!bloop.util.CrossPlatform.isWindows) - state.logger.info(bloop.util.Console.clearCommand) + state.logger.info("\u001b[H\u001b[2J") // Force the first execution before relying on the file watching task fg(state).flatMap(newState => watcher.watch(newState, fg)) diff --git a/frontend/src/main/scala/bloop/io/SourceWatcher.scala b/frontend/src/main/scala/bloop/io/SourceWatcher.scala index eeb46094d8..3838376d42 100644 --- a/frontend/src/main/scala/bloop/io/SourceWatcher.scala +++ b/frontend/src/main/scala/bloop/io/SourceWatcher.scala @@ -42,7 +42,7 @@ final class SourceWatcher private ( def runAction(state: State, events: Seq[DirectoryChangeEvent]): Task[State] = { // Windows is not supported for now if (!bloop.util.CrossPlatform.isWindows) - logger.info(bloop.util.Console.clearCommand) + logger.info("\u001b[H\u001b[2J") // Clean terminal before acting on the event action events.foreach(e => logger.debug(s"A ${e.eventType()} in ${e.path()} has triggered an event")) action(state) } diff --git a/frontend/src/main/scala/bloop/util/Console.scala b/frontend/src/main/scala/bloop/util/Console.scala deleted file mode 100644 index 55438fd1ea..0000000000 --- a/frontend/src/main/scala/bloop/util/Console.scala +++ /dev/null @@ -1,10 +0,0 @@ -package bloop.util - -object Console { - private val escape = "\u001b[" - private val cursorHome = "H" - private val eraseScreen = "2J" - private val eraseScrollbar = "3J" - - val clearCommand: String = escape + cursorHome + escape + eraseScreen + escape + eraseScrollbar -}