mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 17:11:39 +03:00
Merge pull request #294 from leshasmlesha/dev
[FIX] Исправил clear в std
This commit is contained in:
commit
a707dc4f3e
2 changed files with 19 additions and 3 deletions
|
@ -136,6 +136,9 @@ function initConsoleScene() {
|
||||||
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
|
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
|
||||||
consoleMenu.lookup("#send").setOnAction(function(){
|
consoleMenu.lookup("#send").setOnAction(function(){
|
||||||
execCommand(text.getText());
|
execCommand(text.getText());
|
||||||
|
if (text.getText() == "clear") {
|
||||||
|
output.setText("");
|
||||||
|
}
|
||||||
text.setText("");
|
text.setText("");
|
||||||
});
|
});
|
||||||
FunctionalBridge.addPlainOutput(function(string) {
|
FunctionalBridge.addPlainOutput(function(string) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
public class StdCommandHandler extends CommandHandler {
|
public class StdCommandHandler extends CommandHandler {
|
||||||
|
@ -18,8 +18,21 @@ public void bell() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() throws IOException {
|
||||||
throw new UnsupportedOperationException("clear terminal");
|
System.out.flush();
|
||||||
|
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
throw new IOException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.print("\033[H\033[2J");
|
||||||
|
System.out.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue