public boolean yank() throws IOException { String yanked = killRing.yank(); if (yanked == null) { return false; } putString(yanked); return true; }
/** * Pasts the yank buffer to the right of the current cursor position * and moves the cursor to the end of the pasted region. * * @param count Number of times to perform the operation. * @return true if it worked, false otherwise */ private boolean viPut(int count) throws IOException { if (yankBuffer.length () == 0) { return true; } if (buf.cursor < buf.buffer.length ()) { moveCursor(1); } for (int i = 0; i < count; i++) { putString(yankBuffer); } moveCursor(-1); return true; }
public static void setBuffer(final ConsoleReader reader, final CharSequence value, final int offset) throws IOException { while ((reader.getCursorBuffer().cursor > offset) && reader.backspace()) { // empty } reader.putString(value); reader.setCursorPosition(offset + value.length()); }
putString(buffer.substring(sameIndex)); // append the differences
public boolean yankPop() throws IOException { if (!killRing.lastYank()) { return false; } String current = killRing.yank(); if (current == null) { // This shouldn't happen. return false; } backspace(current.length()); String yanked = killRing.yankPop(); if (yanked == null) { // This shouldn't happen. return false; } putString(yanked); return true; }
private String insertComment(boolean isViMode) throws IOException { String comment = this.getCommentBegin(); setCursorPosition(0); putString(comment); if (isViMode) { consoleKeys.setKeyMap(KeyMap.VI_INSERT); } return accept(); }
putString(value);
private void insertClose(String s) throws IOException { putString(s); int closePosition = buf.cursor; moveCursor(-1); viMatch(); if (in.isNonBlockingEnabled()) { in.peek(parenBlinkTimeout); } setCursorPosition(closePosition); flush(); }
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
putString(Character.toString(searchChar)); flush(); break; default: putString(Character.toString((char) ch)); setCursorPosition(0); killLine(); putString(origBuffer.buffer); setCursorPosition(origBuffer.cursor); return -1; setCursorPosition(0); killLine(); putString(origBuffer.buffer); setCursorPosition(0); return -1; putString(history.get(idx)); setCursorPosition(0); flush(); setCursorPosition(0); killLine(); putString(history.get(idx)); setCursorPosition(0);
public boolean yank() throws IOException { String yanked = killRing.yank(); if (yanked == null) { return false; } putString(yanked); return true; }
protected void updateBuffer(final ConsoleReader reader, final CharSequence output, final int offset) throws IOException { while ((reader.getCursorBuffer().cursor > offset) && reader.backspace()) { } if (output != null && output.length() > 0) { reader.putString(output); int newCursorPosition = offset + output.length(); if (output.charAt(output.length()-1) == ')' && output.charAt(output.length()-2) == '(' ) { //we want to put the cursor between the parentheses here newCursorPosition--; } reader.setCursorPosition(newCursorPosition); } }
/** * Pasts the yank buffer to the right of the current cursor position * and moves the cursor to the end of the pasted region. * * @param count Number of times to perform the operation. * @return true if it worked, false otherwise */ private boolean viPut(int count) throws IOException { if (yankBuffer.length () == 0) { return true; } if (buf.cursor < buf.buffer.length ()) { moveCursor(1); } for (int i = 0; i < count; i++) { putString(yankBuffer); } moveCursor(-1); return true; }
public static void setBuffer(final ConsoleReader reader, final CharSequence value, final int offset) throws IOException { while ((reader.getCursorBuffer().cursor > offset) && reader.backspace()) { // empty } reader.putString(value); reader.setCursorPosition(offset + value.length()); }
putString(buffer.substring(sameIndex)); // append the differences
public boolean yankPop() throws IOException { if (!killRing.lastYank()) { return false; } String current = killRing.yank(); if (current == null) { // This shouldn't happen. return false; } backspace(current.length()); String yanked = killRing.yankPop(); if (yanked == null) { // This shouldn't happen. return false; } putString(yanked); return true; }
private String insertComment(boolean isViMode) throws IOException { String comment = this.getCommentBegin(); setCursorPosition(0); putString(comment); if (isViMode) { consoleKeys.setKeyMap(KeyMap.VI_INSERT); } return accept(); }
private void insertClose(String s) throws IOException { putString(s); int closePosition = buf.cursor; moveCursor(-1); viMatch(); if (in.isNonBlockingEnabled()) { in.peek(parenBlinkTimeout); } setCursorPosition(closePosition); flush(); }
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }