diff --git a/src/main/java/org/jline/terminal/TerminalBuilder.java b/src/main/java/org/jline/terminal/TerminalBuilder.java index 8c88b8bd3..c85e0a79a 100644 --- a/src/main/java/org/jline/terminal/TerminalBuilder.java +++ b/src/main/java/org/jline/terminal/TerminalBuilder.java @@ -85,11 +85,31 @@ public TerminalBuilder encoding(String encoding) { return this; } + /** + * Attributes to use when creating a non system terminal, + * i.e. when the builder has been given the input and + * outut streams using the {@link #streams(InputStream, OutputStream)} method + * or when {@link #system(boolean)} has been explicitely called with + * false. + * + * @see #size(Size) + * @see #system(boolean) + */ public TerminalBuilder attributes(Attributes attributes) { this.attributes = attributes; return this; } + /** + * Initial size to use when creating a non system terminal, + * i.e. when the builder has been given the input and + * outut streams using the {@link #streams(InputStream, OutputStream)} method + * or when {@link #system(boolean)} has been explicitely called with + * false. + * + * @see #attributes(Attributes) + * @see #system(boolean) + */ public TerminalBuilder size(Size size) { this.size = size; return this; @@ -180,7 +200,14 @@ else if (OSUtils.IS_WINDOWS) { Log.debug("Error creating JNA based pty", t.getMessage()); } } - return new ExternalTerminal(name, type, in, out, encoding, signalHandler); + Terminal terminal = new ExternalTerminal(name, type, in, out, encoding, signalHandler); + if (attributes != null) { + terminal.setAttributes(attributes); + } + if (size != null) { + terminal.setSize(size); + } + return terminal; } }