-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support clear screen in web console. Fix clearing screen starts new s…
…ession (fixes #66)
- Loading branch information
1 parent
b9eb480
commit 55abe44
Showing
8 changed files
with
96 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
package javarepl.console.commands; | ||
|
||
import javarepl.Evaluator; | ||
import javarepl.completion.CommandCompleter; | ||
import javarepl.console.ConsoleLogger; | ||
|
||
import static com.googlecode.totallylazy.predicates.Predicates.equalTo; | ||
import static com.googlecode.totallylazy.Strings.startsWith; | ||
|
||
public final class ClearScreen extends Command { | ||
public static final String CLEAR_SCREEN_CMD = "CLEAR_SCREEN"; | ||
private static final String COMMAND = ":cls"; | ||
private final Evaluator evaluator; | ||
private final ConsoleLogger logger; | ||
|
||
public ClearScreen(Evaluator evaluator, ConsoleLogger logger) { | ||
super(COMMAND + " - clear screen", equalTo(COMMAND).or(equalTo(null)), new CommandCompleter(COMMAND)); | ||
this.evaluator = evaluator; | ||
public ClearScreen(ConsoleLogger logger) { | ||
super(COMMAND + " - clears screen", startsWith(COMMAND), new CommandCompleter(COMMAND)); | ||
this.logger = logger; | ||
} | ||
|
||
public void execute(String expression) { | ||
this.logger.reset(); | ||
this.logger.info("\033[2J"); | ||
this.logger.control(CLEAR_SCREEN_CMD); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters