Skip to content

Commit

Permalink
Fix attributed string adding underline in ConEMU, #236
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Mar 7, 2018
1 parent cf0f501 commit 1ee156d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public String toAnsi(int colors, boolean force256colors) {
if (background != bg) {
if (bg >= 0) {
int rounded = Colors.roundColor(bg, colors);
if (rounded < 8) {
if (rounded < 8 && !force256colors) {
first = attr(sb, "4" + Integer.toString(rounded), first);
} else if (rounded < 16) {
} else if (rounded < 16 && !force256colors) {
first = attr(sb, "10" + Integer.toString(rounded - 8), first);
} else {
first = attr(sb, "48;5;" + Integer.toString(rounded), first);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

public class AttributedCharSequenceTest {

@Test
public void testUnderline() throws IOException {
AttributedString as = AttributedString.fromAnsi("\33[38;5;0m\33[48;5;15mtest\33[0m");
assertEquals("\33[38;5;0;48;5;15mtest\33[0m", as.toAnsi(256, true));
}

@Test
public void testBoldOnWindows() throws IOException {
String HIC = "\33[36;1m";
Expand Down

0 comments on commit 1ee156d

Please sign in to comment.