本文整理匯總了Java中org.fusesource.jansi.Ansi.eraseLine方法的典型用法代碼示例。如果您正苦於以下問題:Java Ansi.eraseLine方法的具體用法?Java Ansi.eraseLine怎麽用?Java Ansi.eraseLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fusesource.jansi.Ansi
的用法示例。
在下文中一共展示了Ansi.eraseLine方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public void draw(Ansi ansi) {
String prefix = StringUtils.getCommonPrefix(new String[]{text, displayedText});
if (prefix.length() < displayedText.length()) {
ansi.cursorLeft(displayedText.length() - prefix.length());
}
if (prefix.length() < text.length()) {
ColorMap.Color color = colorMap.getStatusBarColor();
color.on(ansi);
ansi.a(text.substring(prefix.length()));
color.off(ansi);
}
if (displayedText.length() > text.length()) {
ansi.eraseLine(Ansi.Erase.FORWARD);
}
displayedText = text;
}
示例2: redraw
import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public void redraw() {
boolean hasTextOnBottomLine = textCursor.row == 0 && textCursor.col > 0;
if (writePos.row == 0 && writtenText.equals(text) && !hasTextOnBottomLine) {
// Does not need to be redrawn
return;
}
Ansi ansi = createAnsi();
if (hasTextOnBottomLine) {
int staleStatusChars = writePos.row > 0 ? 0 : writtenText.length();
writePos.copyFrom(textCursor);
positionCursorAt(writePos, ansi);
if (staleStatusChars > textCursor.col) {
ansi.eraseLine(Ansi.Erase.FORWARD);
}
ansi.newline();
newLineWritten(writePos);
writtenText = "";
} else {
writePos.bottomLeft();
positionCursorAt(writePos, ansi);
}
if (text.length() > 0) {
ColorMap.Color color = colorMap.getStatusBarColor();
color.on(ansi);
ansi.a(text);
color.off(ansi);
}
if (text.length() < writtenText.length()) {
ansi.eraseLine(Ansi.Erase.FORWARD);
}
write(ansi);
charactersWritten(writePos, text.length());
writtenText = text;
}
示例3: doEndLine
import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
@Override
protected void doEndLine(CharSequence endOfLine) {
Ansi ansi = createAnsi();
positionCursorAt(writePos, ansi);
if (writePos.row == statusBarCursor.row && statusBarCursor.col > writePos.col) {
ansi.eraseLine(Ansi.Erase.FORWARD);
}
ansi.newline();
write(ansi);
newLineWritten(writePos);
}
示例4: onDeactivate
import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public void onDeactivate(Ansi ansi) {
if (displayedText.length() > 0) {
ansi.cursorLeft(displayedText.length());
ansi.eraseLine(Ansi.Erase.FORWARD);
displayedText = "";
}
}