Skip to content

Commit

Permalink
TerminalBuilder ignores attributes, fixes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 3, 2016
1 parent b28794c commit e5a38bc
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/main/java/org/jline/terminal/TerminalBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <code>false</code>.
*
* @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
* <code>false</code>.
*
* @see #attributes(Attributes)
* @see #system(boolean)
*/
public TerminalBuilder size(Size size) {
this.size = size;
return this;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit e5a38bc

Please sign in to comment.