Fix: potential windows solution for TUI

This commit is contained in:
2026-06-10 19:08:39 +02:00
parent 0e28f8c6d8
commit 73153762c3
17 changed files with 90 additions and 116 deletions
@@ -15,6 +15,8 @@ import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import static org.jline.builtins.Completers.TreeCompleter.node;
@@ -35,7 +37,12 @@ public class ClientLauncherTUI {
*/
public void main() throws InterruptedException {
try {
terminal = TerminalBuilder.builder().system(true).build();
System.setOut(new PrintStream(System.out, true, StandardCharsets.UTF_8));
System.setErr(new PrintStream(System.err, true, StandardCharsets.UTF_8));
terminal = TerminalBuilder.builder()
.system(true)
.encoding(StandardCharsets.UTF_8)
.build();
} catch (IOException e) {
System.err.println("Could not initialise terminal: " + e.getMessage());
return;
@@ -149,6 +156,7 @@ public class ClientLauncherTUI {
node("totem"),
node("skip"),
node("render"),
node("help"),
node("rematch"),
node("quit")
);
@@ -180,6 +188,7 @@ public class ClientLauncherTUI {
}
case "skip" -> controller.skipTurn();
case "render" -> handleRender(parts);
case "help" -> view.renderHelp();
case "rematch" -> {
if (controller.miniModel == null
|| !controller.miniModel.currentState.getGameStage().equals(GameStages.ENDED)) {