Skip to content

Commit

Permalink
#17: Fixed typos, and @deprecated methods with typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Apr 6, 2014
1 parent 489c4d3 commit 239255c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 25 deletions.
51 changes: 31 additions & 20 deletions jansi/src/main/java/org/fusesource/jansi/Ansi.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,16 @@ public Ansi saveCursorPosition() {
}

@Override
@Deprecated
public Ansi restorCursorPosition() {
return this;
}

@Override
public Ansi restoreCursorPosition() {
return this;
}

@Override
public Ansi reset() {
return this;
Expand Down Expand Up @@ -428,10 +434,15 @@ public Ansi saveCursorPosition() {
return appendEscapeSequence('s');
}

@Deprecated
public Ansi restorCursorPosition() {
return appendEscapeSequence('u');
}

public Ansi restoreCursorPosition() {
return appendEscapeSequence('u');
}

public Ansi reset() {
return a(Attribute.RESET);
}
Expand All @@ -445,91 +456,91 @@ public Ansi boldOff() {
}

public Ansi a(String value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(boolean value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(char value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(char[] value, int offset, int len) {
flushAtttributes();
flushAttributes();
builder.append(value, offset, len);
return this;
}

public Ansi a(char[] value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(CharSequence value, int start, int end) {
flushAtttributes();
flushAttributes();
builder.append(value, start, end);
return this;
}

public Ansi a(CharSequence value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(double value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(float value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(int value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(long value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(Object value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi a(StringBuffer value) {
flushAtttributes();
flushAttributes();
builder.append(value);
return this;
}

public Ansi newline() {
flushAtttributes();
flushAttributes();
builder.append(System.getProperty("line.separator"));
return this;
}

public Ansi format(String pattern, Object... args) {
flushAtttributes();
flushAttributes();
builder.append(String.format(pattern, args));
return this;
}
Expand Down Expand Up @@ -561,7 +572,7 @@ public Ansi render(final String text, Object... args) {

@Override
public String toString() {
flushAtttributes();
flushAttributes();
return builder.toString();
}

Expand All @@ -570,15 +581,15 @@ public String toString() {
///////////////////////////////////////////////////////////////////

private Ansi appendEscapeSequence(char command) {
flushAtttributes();
flushAttributes();
builder.append(FIRST_ESC_CHAR);
builder.append(SECOND_ESC_CHAR);
builder.append(command);
return this;
}

private Ansi appendEscapeSequence(char command, int option) {
flushAtttributes();
flushAttributes();
builder.append(FIRST_ESC_CHAR);
builder.append(SECOND_ESC_CHAR);
builder.append(option);
Expand All @@ -587,11 +598,11 @@ private Ansi appendEscapeSequence(char command, int option) {
}

private Ansi appendEscapeSequence(char command, Object... options) {
flushAtttributes();
flushAttributes();
return _appendEscapeSequence(command, options);
}

private void flushAtttributes() {
private void flushAttributes() {
if( attributeOptions.isEmpty() )
return;
if (attributeOptions.size() == 1 && attributeOptions.get(0) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ private void applyAttribute() throws IOException {
}
}

private short invertAttributeColors(short attibutes) {
private short invertAttributeColors(short attributes) {
// Swap the the Foreground and Background bits.
int fg = 0x000F & attibutes;
int fg = 0x000F & attributes;
fg <<= 8;
int bg = 0X00F0 * attibutes;
int bg = 0X00F0 * attributes;
bg >>=8;
attibutes = (short) ((attibutes & 0xFF00) | fg | bg);
return attibutes;
attributes = (short) ((attributes & 0xFF00) | fg | bg);
return attributes;
}

private void applyCursorPosition() throws IOException {
Expand Down

0 comments on commit 239255c

Please sign in to comment.