本文整理匯總了Java中org.fusesource.jansi.Ansi.cursorLeft方法的典型用法代碼示例。如果您正苦於以下問題:Java Ansi.cursorLeft方法的具體用法?Java Ansi.cursorLeft怎麽用?Java Ansi.cursorLeft使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fusesource.jansi.Ansi
的用法示例。
在下文中一共展示了Ansi.cursorLeft方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: positionCursorAt
import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
private void positionCursorAt(Cursor position, Ansi ansi) {
if (writeCursor.row == position.row) {
if (writeCursor.col == position.col) {
return;
}
if (writeCursor.col < position.col) {
ansi.cursorRight(position.col - writeCursor.col);
} else {
ansi.cursorLeft(writeCursor.col - position.col);
}
} else {
if (writeCursor.col > 0) {
ansi.cursorLeft(writeCursor.col);
}
if (writeCursor.row < position.row) {
ansi.cursorUp(position.row - writeCursor.row);
} else {
ansi.cursorDown(writeCursor.row - position.row);
}
if (position.col > 0) {
ansi.cursorRight(position.col);
}
}
writeCursor.copyFrom(position);
}
示例2: 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;
}
示例3: 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 = "";
}
}