/** * Write the specific character into the buffer, setting the cursor position * ahead one. The text may overwrite or insert based on the current setting * of {@link #isOverTyping}. * * @param c the character to insert */ public void write(final char c) { buffer.insert(cursor++, c); if (isOverTyping() && cursor < buffer.length()) { buffer.deleteCharAt(cursor); } }
/** * Insert the specified chars into the buffer, setting the cursor to the end of the insertion point. */ public void write(final CharSequence str) { checkNotNull(str); if (buffer.length() == 0) { buffer.append(str); } else { buffer.insert(cursor, str); } cursor += str.length(); if (isOverTyping() && cursor < buffer.length()) { buffer.delete(cursor, cursor + str.length()); } }
/** * 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 }
/** * Write the specific character into the buffer, setting the cursor position * ahead one. The text may overwrite or insert based on the current setting * of {@link #isOverTyping}. * * @param c the character to insert */ public void write(final char c) { buffer.insert(cursor++, c); if (isOverTyping() && cursor < buffer.length()) { buffer.deleteCharAt(cursor); } }
/** * Insert the specified chars into the buffer, setting the cursor to the end of the insertion point. */ public void write(final CharSequence str) { checkNotNull(str); if (buffer.length() == 0) { buffer.append(str); } else { buffer.insert(cursor, str); } cursor += str.length(); if (isOverTyping() && cursor < buffer.length()) { buffer.delete(cursor, cursor + str.length()); } }
/** * 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 }