org.fusesource.jansi.Ansi.cursorDown()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.fusesource.jansi.Ansi.cursorDown()方法的一些代码示例,展示了Ansi.cursorDown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ansi.cursorDown()方法的具体详情如下:
包路径:org.fusesource.jansi.Ansi
类名称:Ansi
方法名:cursorDown

Ansi.cursorDown介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

private Ansi moveDownToSkipPrompt() {
  return ansi()
    .cursorDown(1)
    .cursorLeft(PROMPT.length());
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private void updateAnsiProgress(String imageId, String status, String progressMessage) {
  Map<String,Integer> imgLineMap = imageLines.get();
  Integer line = imgLineMap.get(imageId);
  int diff = 0;
  if (line == null) {
    line = imgLineMap.size();
    imgLineMap.put(imageId, line);
  } else {
    diff = imgLineMap.size() - line;
  }
  if (diff > 0) {
    print(ansi().cursorUp(diff).eraseLine(Ansi.Erase.ALL).toString());
  }
  // Status with progress bars: (max length = 11, hence pad to 11)
  // Extracting
  // Downloading
  String progress = progressMessage != null ? progressMessage : "";
  String msg =
    ansi()
      .fg(COLOR_PROGRESS_ID).a(imageId).reset().a(": ")
      .fg(COLOR_PROGRESS_STATUS).a(StringUtils.rightPad(status,11) + " ")
      .fg(COLOR_PROGRESS_BAR).a(progress).toString();
  println(msg);
  if (diff > 0) {
    // move cursor back down to bottom
    print(ansi().cursorDown(diff - 1).toString());
  }
}

代码示例来源:origin: org.grails/grails-bootstrap

private Ansi moveDownToSkipPrompt() {
    return ansi()
        .cursorDown(1)
        .cursorLeft(PROMPT.length());
}

代码示例来源:origin: org.gradle/gradle-logging

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);
}

相关文章