Skip to content

Commit

Permalink
ExternalTerminal should accept attributes (eg ECHO false) in construc…
Browse files Browse the repository at this point in the history
…tor, and set them before starting pump thread, fixes #433
  • Loading branch information
gnodet committed Jan 6, 2020
1 parent 2327d64 commit 37ef992
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,7 @@ private Terminal doBuild() throws IOException {
Log.debug("Error creating JANSI based terminal: ", t.getMessage(), t);
}
}
Terminal terminal = new ExternalTerminal(name, type, in, out, encoding, signalHandler, paused);
if (attributes != null) {
terminal.setAttributes(attributes);
}
if (size != null) {
terminal.setSize(size);
}
return terminal;
return new ExternalTerminal(name, type, in, out, encoding, signalHandler, paused, attributes, size);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
*/
package org.jline.terminal.impl;

import org.jline.terminal.Attributes;
import org.jline.terminal.Cursor;
import org.jline.terminal.Size;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -57,8 +59,25 @@ public ExternalTerminal(String name, String type,
Charset encoding,
SignalHandler signalHandler,
boolean paused) throws IOException {
this(name, type, masterInput, masterOutput, encoding, signalHandler, paused, null, null);
}

public ExternalTerminal(String name, String type,
InputStream masterInput,
OutputStream masterOutput,
Charset encoding,
SignalHandler signalHandler,
boolean paused,
Attributes attributes,
Size size) throws IOException {
super(name, type, masterOutput, encoding, signalHandler);
this.masterInput = masterInput;
if (attributes != null) {
setAttributes(attributes);
}
if (size != null) {
setSize(size);
}
if (!paused) {
resume();
}
Expand Down

0 comments on commit 37ef992

Please sign in to comment.