org.jline.reader.History.get()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(92)

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

History.get介绍

暂无

代码示例

代码示例来源:origin: apache/karaf

@Override
  public CharSequence get(int index) {
    return history.get(index - 1);
  }
}

代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.core

@Override
  public CharSequence get(int index) {
    return history.get(index - 1);
  }
}

代码示例来源:origin: org.jline/jline

rep = history.get(history.index() - 1);
  break;
case '#':
    throw new IllegalArgumentException("!?" + sc + ": event not found");
  } else {
    rep = history.get(idx);
  String previous = history.get(history.index() - 1).trim();
  int lastSpace = previous.lastIndexOf(' ');
  if (lastSpace != -1) {
    rep = history.get(history.index() - idx);
  } else if (!neg && idx > history.index() - history.size() && idx <= history.index()) {
    rep = history.get(idx - 1);
  } else {
    throw new IllegalArgumentException((neg ? "!-" : "!") + line.substring(i1, i) + ": event not found");
    throw new IllegalArgumentException("!" + ss + ": event not found");
  } else {
    rep = history.get(idx);
String s1 = line.substring(i + 1, i1);
String s2 = line.substring(i1 + 1, i2);
String s = history.get(history.index() - 1).replace(s1, s2);
sb.append(s);
i = i2 + 1;

代码示例来源:origin: org.jline/jline

protected boolean viRepeatSearch() {
  if (searchDir == 0) {
    return false;
  }
  int si = searchDir < 0
      ? searchBackwards(searchString, searchIndex, false)
      : searchForwards(searchString, searchIndex, false);
  if (si == -1 || si == history.index()) {
    return false;
  }
  searchIndex = si;
  /*
   * Show the match.
   */
  buf.clear();
  history.moveTo(searchIndex);
  buf.write(history.get(searchIndex));
  if (VICMD.equals(keyMap)) {
    buf.move(-1);
  }
  return true;
}

代码示例来源:origin: org.jline/jline

buf.clear();
if (searchIndex >= 0) {
  buf.write(history.get(searchIndex));
} else {
  buf.write(originalBuffer.toString());

相关文章