Skip to content

Commit

Permalink
Allow registering the terminal in the jansi layer
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 3, 2023
1 parent 83edddf commit 08b46d3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jansi-core/src/main/java/org/jline/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ public static int getTerminalWidth() {

private AnsiConsole() {}

public static Terminal getTerminal() {
return terminal;
}

public static void setTerminal(Terminal terminal) {
AnsiConsole.terminal = terminal;
}

/**
* Initialize the out/err ansi-enabled streams
*/
Expand All @@ -199,6 +207,8 @@ static synchronized void doInstall() {
builder.dumb(Boolean.parseBoolean(graceful));
}
terminal = builder.build();
}
if (out == null) {
out = ansiStream(true);
err = ansiStream(false);
}
Expand Down

0 comments on commit 08b46d3

Please sign in to comment.