Skip to content

Commit

Permalink
Dumb terminal related fix (related to #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 21, 2016
1 parent fecb812 commit c9c1a15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/jline/utils/AttributedCharSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public String toAnsi() {
public String toAnsi(Terminal terminal) {
StringBuilder sb = new StringBuilder();
int style = 0;
Integer max_colors = terminal == null ? null
Integer max_colors = terminal == null ? Integer.valueOf(8)
: terminal.getNumericCapability(Capability.max_colors);
boolean color8 = max_colors != null && max_colors >= 8;
boolean color256 = max_colors != null && max_colors >= 256;
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/jline/reader/impl/ReaderTestSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.logging.ConsoleHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ public void setUp() throws Exception {

in = new EofPipedInputStream();
out = new ByteArrayOutputStream();
terminal = new DumbTerminal(in, out);
terminal = new DumbTerminal("terminal", "ansi", in, out, Charset.defaultCharset().name());
terminal.setSize(new Size(160, 80));
reader = new TestLineReader(terminal, "JLine", null);
reader.setKeyMap(LineReaderImpl.EMACS);
Expand Down

0 comments on commit c9c1a15

Please sign in to comment.