本文整理汇总了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 = "";
}
}