/** * Deletes the previous character from the cursor position * @return <code>true</code> if it succeeded, <code>false</code> otherwise */ protected boolean viBackwardDeleteChar() { for (int i = 0; i < count; i++) { if (!buf.backspace()) { return false; } } return true; }
protected boolean backwardDeleteChar() { if (count < 0) { return callNeg(this::deleteChar); } if (buf.cursor() == 0) { return false; } buf.backspace(count); return true; }
public boolean yankPop() { if (!killRing.lastYank()) { return false; } String current = killRing.yank(); if (current == null) { // This shouldn't happen. return false; } buf.backspace(current.length()); String yanked = killRing.yankPop(); if (yanked == null) { // This shouldn't happen. return false; } putString(yanked); return true; }
protected boolean viJoin() { if (buf.down()) { while (buf.move(-1) == -1 && buf.prevChar() != '\n') ; buf.backspace(); buf.write(' '); buf.move(-1); return true; } return false; }
if (!line.word().equals(w)) { if (prefix) { buf.backspace(line.wordCursor()); } else { buf.move(line.word().length() - line.wordCursor()); buf.backspace(line.word().length()); buf.backspace(line.rawWordCursor()); } else { buf.move(line.rawWordLength() - line.rawWordCursor()); buf.backspace(line.rawWordLength()); if (SELF_INSERT.equals(ref) && chars.indexOf(getLastBinding().charAt(0)) >= 0 || ACCEPT_LINE.equals(ref)) { buf.backspace(completion.suffix().length()); if (getLastBinding().charAt(0) != ' ') { buf.write(' '); buf.backspace(line.word().length()); doMenu(possible, line.word(), line::escape); return true; buf.backspace(line.rawWordLength()); buf.write(line.escape(commonPrefix, false)); current = commonPrefix; buf.backspace(current.length()); doMenu(possible, line.word(), line::escape);
protected boolean backwardDeleteWord() { if (count < 0) { return callNeg(this::deleteWord); } int cursor = buf.cursor(); while (count-- > 0) { while (cursor > 0 && !isWord(buf.atChar(cursor - 1))) { cursor--; } while (cursor > 0 && isWord(buf.atChar(cursor - 1))) { cursor--; } } buf.backspace(buf.cursor() - cursor); return true; }
private void update() { buf.backspace(word.length()); word = escaper.apply(completion().value(), true).toString(); buf.write(word);
&& chars.indexOf(getLastBinding().charAt(0)) >= 0 || BACKWARD_DELETE_CHAR.equals(ref)) { buf.backspace(completion.suffix().length());
protected boolean backwardKillWord() { if (count < 0) { return callNeg(this::killWord); } int x = buf.cursor(); while (count-- > 0) { while (x > 0 && !isWord(buf.atChar(x - 1))) { x--; } while (x > 0 && isWord(buf.atChar(x - 1))) { x--; } } killRing.addBackwards(buf.substring(x, buf.cursor())); buf.backspace(buf.cursor() - x); return true; }
protected boolean viBackwardKillWord() { if (count < 0) { return false; } int lim = findbol(); int x = buf.cursor(); while (count-- > 0) { while (x > lim && isWhitespace(buf.atChar(x - 1))) { x--; } if (x > lim) { if (isViAlphaNum(buf.atChar(x - 1))) { while (x > lim && isViAlphaNum(buf.atChar(x - 1))) { x--; } } else { while (x > lim && !isViAlphaNum(buf.atChar(x - 1)) && !isWhitespace(buf.atChar(x - 1))) { x--; } } } } killRing.addBackwards(buf.substring(x, buf.cursor())); buf.backspace(buf.cursor() - x); return true; }