Flushable
, LineReader
public class LineReaderImpl extends Object implements LineReader, Flushable
Modifier and Type | Class | Description |
---|---|---|
protected static class |
LineReaderImpl.BellType |
|
protected static class |
LineReaderImpl.CompletionType |
|
protected static class |
LineReaderImpl.PostResult |
|
protected static class |
LineReaderImpl.State |
Possible states in which the current readline operation may be in.
|
protected static class |
LineReaderImpl.ViMoveMode |
LineReader.Option, LineReader.RegionType, LineReader.SuggestionType
ACCEPT_AND_HOLD, ACCEPT_AND_INFER_NEXT_HISTORY, ACCEPT_LINE, ACCEPT_LINE_AND_DOWN_HISTORY, AMBIGUOUS_BINDING, ARGUMENT_BASE, BACKWARD_CHAR, BACKWARD_DELETE_CHAR, BACKWARD_DELETE_WORD, BACKWARD_KILL_LINE, BACKWARD_KILL_WORD, BACKWARD_WORD, BEEP, BEGIN_PASTE, BEGINNING_OF_BUFFER_OR_HISTORY, BEGINNING_OF_HISTORY, BEGINNING_OF_LINE, BEGINNING_OF_LINE_HIST, BELL_STYLE, BIND_TTY_SPECIAL_CHARS, BLINK_MATCHING_PAREN, CALLBACK_FINISH, CALLBACK_INIT, CALLBACK_KEYMAP, CAPITALIZE_WORD, CHARACTER_SEARCH, CHARACTER_SEARCH_BACKWARD, CLEAR, CLEAR_SCREEN, COMMENT_BEGIN, COMPLETE_PREFIX, COMPLETE_WORD, COMPLETION_STYLE_DESCRIPTION, COMPLETION_STYLE_GROUP, COMPLETION_STYLE_SELECTION, COMPLETION_STYLE_STARTING, COPY_PREV_WORD, COPY_REGION_AS_KILL, DELETE_CHAR, DELETE_CHAR_OR_LIST, DELETE_WORD, DIGIT_ARGUMENT, DISABLE_COMPLETION, DISABLE_HISTORY, DO_LOWERCASE_VERSION, DOWN_CASE_WORD, DOWN_HISTORY, DOWN_LINE, DOWN_LINE_OR_HISTORY, DOWN_LINE_OR_SEARCH, EDIT_AND_EXECUTE_COMMAND, EDITING_MODE, EMACS, EMACS_BACKWARD_WORD, EMACS_EDITING_MODE, EMACS_FORWARD_WORD, END_OF_BUFFER_OR_HISTORY, END_OF_HISTORY, END_OF_LINE, END_OF_LINE_HIST, ERRORS, EXCHANGE_POINT_AND_MARK, EXECUTE_NAMED_CMD, EXPAND_HISTORY, EXPAND_OR_COMPLETE, EXPAND_OR_COMPLETE_PREFIX, EXPAND_WORD, FEATURES_MAX_BUFFER_SIZE, FOCUS_IN, FOCUS_OUT, FORWARD_CHAR, FORWARD_WORD, FRESH_LINE, HISTORY_BEGINNING_SEARCH_BACKWARD, HISTORY_BEGINNING_SEARCH_FORWARD, HISTORY_FILE, HISTORY_FILE_SIZE, HISTORY_IGNORE, HISTORY_INCREMENTAL_PATTERN_SEARCH_BACKWARD, HISTORY_INCREMENTAL_PATTERN_SEARCH_FORWARD, HISTORY_INCREMENTAL_SEARCH_BACKWARD, HISTORY_INCREMENTAL_SEARCH_FORWARD, HISTORY_SEARCH_BACKWARD, HISTORY_SEARCH_FORWARD, HISTORY_SIZE, INDENTATION, INFER_NEXT_HISTORY, INSERT_CLOSE_CURLY, INSERT_CLOSE_PAREN, INSERT_CLOSE_SQUARE, INSERT_COMMENT, INSERT_LAST_WORD, KEYMAP, KILL_BUFFER, KILL_LINE, KILL_REGION, KILL_WHOLE_LINE, KILL_WORD, LINE_OFFSET, LIST_CHOICES, LIST_EXPAND, LIST_MAX, MAGIC_SPACE, MAIN, MENU, MENU_COMPLETE, MENU_EXPAND_OR_COMPLETE, MENU_SELECT, MOUSE, NEG_ARGUMENT, ORIGINAL_GROUP_NAME, OTHERS_GROUP_NAME, OVERWRITE_MODE, PREFER_VISIBLE_BELL, PROP_SUPPORT_PARSEDLINE, PUT_REPLACE_SELECTION, QUOTED_INSERT, READ_COMMAND, RECURSIVE_EDIT, REDISPLAY, REDO, REDRAW_LINE, REMOVE_SUFFIX_CHARS, REVERSE_MENU_COMPLETE, SAFE, SEARCH_TERMINATORS, SECONDARY_PROMPT_PATTERN, SELF_INSERT, SELF_INSERT_UNMETA, SEND_BREAK, SET_LOCAL_HISTORY, SET_MARK_COMMAND, SPELL_WORD, SPLIT_UNDO, TRANSPOSE_CHARS, TRANSPOSE_WORDS, UNDEFINED_KEY, UNDO, UNIVERSAL_ARGUMENT, UP_CASE_WORD, UP_HISTORY, UP_LINE, UP_LINE_OR_HISTORY, UP_LINE_OR_SEARCH, VI_ADD_EOL, VI_ADD_NEXT, VI_BACKWARD_BLANK_WORD, VI_BACKWARD_BLANK_WORD_END, VI_BACKWARD_CHAR, VI_BACKWARD_DELETE_CHAR, VI_BACKWARD_KILL_WORD, VI_BACKWARD_WORD, VI_BACKWARD_WORD_END, VI_BEGINNING_OF_LINE, VI_CHANGE, VI_CHANGE_EOL, VI_CHANGE_WHOLE_LINE, VI_CMD_MODE, VI_DELETE, VI_DELETE_CHAR, VI_DIGIT_OR_BEGINNING_OF_LINE, VI_DOWN_LINE_OR_HISTORY, VI_END_OF_LINE, VI_FETCH_HISTORY, VI_FIND_NEXT_CHAR, VI_FIND_NEXT_CHAR_SKIP, VI_FIND_PREV_CHAR, VI_FIND_PREV_CHAR_SKIP, VI_FIRST_NON_BLANK, VI_FORWARD_BLANK_WORD, VI_FORWARD_BLANK_WORD_END, VI_FORWARD_CHAR, VI_FORWARD_WORD, VI_FORWARD_WORD_END, VI_GOTO_COLUMN, VI_HISTORY_SEARCH_BACKWARD, VI_HISTORY_SEARCH_FORWARD, VI_INSERT, VI_INSERT_BOL, VI_INSERT_COMMENT, VI_JOIN, VI_KILL_EOL, VI_KILL_LINE, VI_MATCH_BRACKET, VI_OPEN_LINE_ABOVE, VI_OPEN_LINE_BELOW, VI_OPER_SWAP_CASE, VI_PUT_AFTER, VI_PUT_BEFORE, VI_QUOTED_INSERT, VI_REPEAT_CHANGE, VI_REPEAT_FIND, VI_REPEAT_SEARCH, VI_REPLACE, VI_REPLACE_CHARS, VI_REV_REPEAT_FIND, VI_REV_REPEAT_SEARCH, VI_SET_BUFFER, VI_SUBSTITUTE, VI_SWAP_CASE, VI_UNDO_CHANGE, VI_UP_LINE_OR_HISTORY, VI_YANK, VI_YANK_EOL, VI_YANK_WHOLE_LINE, VICMD, VIINS, VIOPP, VISUAL, VISUAL_LINE_MODE, VISUAL_MODE, WHAT_CURSOR_POSITION, WORDCHARS, YANK, YANK_POP
Constructor | Description |
---|---|
LineReaderImpl(Terminal terminal) |
|
LineReaderImpl(Terminal terminal,
String appName) |
|
LineReaderImpl(Terminal terminal,
String appName,
Map<String,Object> variables) |
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
acceptAndHold() |
|
protected boolean |
acceptAndInferNextHistory() |
|
protected boolean |
acceptLine() |
|
protected boolean |
acceptLineAndDownHistory() |
|
void |
addCommandsInBuffer(Collection<String> commands) |
|
protected boolean |
argumentBase() |
|
protected boolean |
backwardChar() |
|
protected boolean |
backwardDeleteChar() |
|
protected boolean |
backwardDeleteWord() |
|
boolean |
backwardKillLine() |
|
protected boolean |
backwardKillWord() |
|
protected boolean |
backwardWord() |
|
boolean |
beep() |
Issue an audible keyboard bell.
|
protected boolean |
beginningOfBufferOrHistory() |
|
protected boolean |
beginningOfHistory() |
|
protected boolean |
beginningOfLine() |
|
protected boolean |
beginningOfLineHist() |
|
boolean |
beginPaste() |
|
protected AttributedStyle |
buildStyle(String str) |
|
protected Map<String,Widget> |
builtinWidgets() |
|
void |
callWidget(String name) |
|
protected boolean |
capitalizeWord() |
|
protected void |
cleanup() |
|
boolean |
clear() |
Clean the used display
|
protected boolean |
clearChoices() |
|
boolean |
clearScreen() |
Clear the screen by issuing the ANSI "clear screen" code.
|
protected boolean |
completePrefix() |
|
protected boolean |
completeWord() |
|
protected LineReaderImpl.PostResult |
computePost(List<Candidate> possible,
Candidate selection,
List<Candidate> ordered,
String completed) |
|
protected LineReaderImpl.PostResult |
computePost(List<Candidate> possible,
Candidate selection,
List<Candidate> ordered,
String completed,
Function<String,Integer> wcwidth,
int width,
boolean autoGroup,
boolean groupName,
boolean rowsFirst) |
|
protected boolean |
copyPrevWord() |
|
boolean |
copyRegionAsKill() |
|
protected boolean |
deactivateRegion() |
|
Map<String,KeyMap<Binding>> |
defaultKeyMaps() |
|
protected boolean |
deleteChar() |
|
protected boolean |
deleteCharOrList() |
|
protected boolean |
deleteWord() |
|
protected boolean |
digitArgument() |
|
protected void |
doCleanup(boolean nl) |
|
protected boolean |
doComplete(LineReaderImpl.CompletionType lst,
boolean useMenu,
boolean prefix) |
|
protected boolean |
doComplete(LineReaderImpl.CompletionType lst,
boolean useMenu,
boolean prefix,
boolean forSuggestion) |
|
protected boolean |
doInsertComment(boolean isViMode) |
|
protected boolean |
doList(List<Candidate> possible,
String completed,
boolean runLoop,
BiFunction<CharSequence,Boolean,CharSequence> escaper) |
|
protected boolean |
doList(List<Candidate> possible,
String completed,
boolean runLoop,
BiFunction<CharSequence,Boolean,CharSequence> escaper,
boolean forSuggestion) |
|
protected boolean |
doLowercaseVersion() |
|
protected boolean |
doMenu(List<Candidate> original,
String completed,
BiFunction<CharSequence,Boolean,CharSequence> escaper) |
|
protected <T> T |
doReadBinding(KeyMap<T> keys,
KeyMap<T> local) |
|
protected String |
doReadStringUntil(String sequence) |
|
protected boolean |
doSearchHistory(boolean backward) |
|
protected boolean |
doViDeleteOrChange(int startPos,
int endPos,
boolean isChange) |
Performs the vi "delete-to" action, deleting characters between a given
span of the input line.
|
protected boolean |
doViMatchBracket() |
Implements vi style bracket matching ("%" command).
|
protected boolean |
downCaseWord() |
|
protected boolean |
downHistory() |
|
protected boolean |
downLine() |
|
protected boolean |
downLineOrHistory() |
|
protected boolean |
downLineOrSearch() |
|
void |
editAndAddInBuffer(File file) |
|
protected boolean |
editAndExecute() |
|
KeyMap<Binding> |
emacs() |
|
protected boolean |
emacsBackwardWord() |
|
protected boolean |
emacsEditingMode() |
|
protected boolean |
emacsForwardWord() |
|
protected boolean |
endOfBufferOrHistory() |
|
protected boolean |
endOfHistory() |
|
protected boolean |
endOfLine() |
|
protected boolean |
endOfLineHist() |
|
protected boolean |
exchangePointAndMark() |
|
protected boolean |
expandHistory() |
|
protected boolean |
expandOrComplete() |
|
protected boolean |
expandOrCompletePrefix() |
|
protected boolean |
expandWord() |
|
protected String |
finish(String str) |
|
protected String |
finishBuffer() |
Clear the buffer and add its contents to the history.
|
void |
flush() |
Flush the terminal output stream.
|
boolean |
focusIn() |
|
boolean |
focusOut() |
|
protected boolean |
forwardChar() |
|
protected boolean |
forwardWord() |
|
protected boolean |
freshLine() |
|
String |
getAppName() |
|
LineReader.SuggestionType |
getAutosuggestion() |
|
protected int |
getBracketType(int ch) |
Given a character determines what type of bracket it is (paren,
square, curly, or none).
|
Buffer |
getBuffer() |
|
Map<String,Widget> |
getBuiltinWidgets() |
|
protected Comparator<Candidate> |
getCandidateComparator(boolean caseInsensitive,
String word) |
|
Completer |
getCompleter() |
Returns the completer.
|
protected AttributedStyle |
getCompletionStyle(String name,
String value) |
|
protected AttributedStyle |
getCompletionStyleDescription() |
|
protected AttributedStyle |
getCompletionStyleGroup() |
|
protected AttributedStyle |
getCompletionStyleSelection() |
|
AttributedString |
getDisplayedBufferWithPrompts(List<AttributedString> secondaryPrompts) |
Compute the full string to be displayed with the left, right and secondary prompts
|
Expander |
getExpander() |
|
protected Comparator<String> |
getGroupComparator() |
|
Highlighter |
getHighlighter() |
|
History |
getHistory() |
|
String |
getKeyMap() |
Returns the name of the current key mapping.
|
Map<String,KeyMap<Binding>> |
getKeyMaps() |
|
KeyMap<Binding> |
getKeys() |
|
String |
getLastBinding() |
|
protected String |
getOriginalGroupName() |
|
protected String |
getOthersGroupName() |
|
ParsedLine |
getParsedLine() |
|
Parser |
getParser() |
|
LineReader.RegionType |
getRegionActive() |
|
int |
getRegionMark() |
|
String |
getSearchTerm() |
|
String |
getTailTip() |
|
Terminal |
getTerminal() |
|
Object |
getVariable(String name) |
|
Map<String,Object> |
getVariables() |
|
protected Widget |
getWidget(Object binding) |
|
Map<String,Widget> |
getWidgets() |
|
protected void |
handleSignal(Terminal.Signal signal) |
|
protected boolean |
historyIncrementalSearchBackward() |
|
protected boolean |
historyIncrementalSearchForward() |
|
protected boolean |
historySearchBackward() |
|
protected boolean |
historySearchForward() |
|
protected boolean |
insertClose(String s) |
|
protected boolean |
insertCloseCurly() |
|
protected boolean |
insertCloseParen() |
|
protected boolean |
insertCloseSquare() |
|
protected boolean |
insertComment() |
|
protected boolean |
insertTab() |
|
protected boolean |
isAlpha(int c) |
|
protected boolean |
isDelimiter(int c) |
Checks to see if the specified character is a delimiter.
|
protected boolean |
isInViChangeOperation() |
|
protected boolean |
isInViCmdMode() |
|
protected boolean |
isInViMoveOperation() |
|
boolean |
isKeyMap(String name) |
|
boolean |
isReading() |
Check if a thread is currently in a
readLine() call. |
boolean |
isSet(LineReader.Option option) |
|
protected boolean |
isViAlphaNum(int c) |
|
protected boolean |
isWhitespace(int c) |
Checks to see if a character is a whitespace character.
|
protected boolean |
isWord(int c) |
|
protected boolean |
killBuffer() |
|
boolean |
killLine() |
Kill the buffer ahead of the current cursor position.
|
boolean |
killRegion() |
|
protected boolean |
killWholeLine() |
|
protected boolean |
killWord() |
|
protected boolean |
listChoices() |
|
KeyMap<Binding> |
menu() |
|
protected boolean |
menuComplete() |
|
protected boolean |
menuExpandOrComplete() |
|
boolean |
mouse() |
|
protected boolean |
moveHistory(boolean next) |
Move up or down the history tree.
|
protected boolean |
moveHistory(boolean next,
int count) |
Used in "vi" mode for argumented history move, to move a specific
number of history entries forward or back.
|
protected boolean |
negArgument() |
|
protected boolean |
nextBindingIsComplete() |
|
LineReader |
option(LineReader.Option option,
boolean value) |
|
protected boolean |
overwriteMode() |
|
int |
peekCharacter(long timeout) |
|
void |
printAbove(String str) |
Prints a line above the prompt and redraw everything.
|
void |
printAbove(AttributedString str) |
Prints a string before the prompt and redraw everything.
|
void |
putString(CharSequence str) |
Write out the specified string to the buffer and the output stream.
|
protected boolean |
quit() |
|
protected boolean |
quotedInsert() |
|
Binding |
readBinding(KeyMap<Binding> keys) |
Read from the input stream and decode an operation from the key map.
|
Binding |
readBinding(KeyMap<Binding> keys,
KeyMap<Binding> local) |
|
int |
readCharacter() |
Read a character from the terminal.
|
String |
readLine() |
Read the next line and return the contents of the buffer.
|
String |
readLine(Character mask) |
Read the next line with the specified character mask.
|
String |
readLine(String prompt) |
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
String |
readLine(String prompt,
Character mask) |
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
String |
readLine(String prompt,
Character mask,
String buffer) |
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
String |
readLine(String prompt,
String rightPrompt,
Character mask,
String buffer) |
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
String |
readLine(String prompt,
String rightPrompt,
MaskingCallback maskingCallback,
String buffer) |
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
MouseEvent |
readMouseEvent() |
Read a mouse event when the
InfoCmp.Capability.key_mouse sequence
has just been read on the input stream. |
boolean |
redisplay() |
|
protected void |
redisplay(boolean flush) |
|
protected boolean |
redo() |
|
boolean |
redrawLine() |
Clear the line and redraw it.
|
void |
runMacro(String macro) |
Push back a key sequence that will be later consumed by the line reader.
|
KeyMap<Binding> |
safe() |
|
int |
searchBackwards(String searchTerm) |
Search backwards in history from the current position.
|
int |
searchBackwards(String searchTerm,
int startIndex) |
Search backward in history from a given position.
|
int |
searchBackwards(String searchTerm,
int startIndex,
boolean startsWith) |
|
int |
searchForwards(String searchTerm) |
Search forwards in history from the current position.
|
int |
searchForwards(String searchTerm,
int startIndex) |
Search forward in history from a given position.
|
int |
searchForwards(String searchTerm,
int startIndex,
boolean startsWith) |
|
protected boolean |
selfInsert() |
|
protected boolean |
selfInsertUnmeta() |
|
protected boolean |
sendBreak() |
|
void |
setAutosuggestion(LineReader.SuggestionType type) |
|
protected void |
setBuffer(String buffer) |
Set the current buffer's content to the specified
String . |
protected void |
setBuffer(Buffer buffer) |
|
void |
setCompleter(Completer completer) |
Set the completer.
|
void |
setExpander(Expander expander) |
|
void |
setHighlighter(Highlighter highlighter) |
|
void |
setHistory(History history) |
|
boolean |
setKeyMap(String name) |
Sets the current keymap by name.
|
protected boolean |
setMarkCommand() |
|
void |
setOpt(LineReader.Option option) |
|
void |
setParser(Parser parser) |
|
void |
setPrompt(String prompt) |
|
void |
setRightPrompt(String rightPrompt) |
|
void |
setTailTip(String tailTip) |
|
void |
setVariable(String name,
Object value) |
|
protected int |
switchCase(int ch) |
|
protected void |
toColumns(Object items,
int width,
int maxWidth,
AttributedStringBuilder sb,
Candidate selection,
String completed,
boolean rowsFirst,
int[] out) |
|
protected LineReaderImpl.PostResult |
toColumns(List<Object> items,
Candidate selection,
String completed,
Function<String,Integer> wcwidth,
int width,
boolean rowsFirst) |
|
protected boolean |
transposeChars() |
Performs character transpose.
|
protected boolean |
transposeWords() |
|
protected boolean |
undefinedKey() |
|
protected boolean |
undo() |
|
protected boolean |
universalArgument() |
|
void |
unsetOpt(LineReader.Option option) |
|
protected boolean |
upCaseWord() |
|
protected boolean |
upHistory() |
|
protected boolean |
upLine() |
|
protected boolean |
upLineOrHistory() |
|
protected boolean |
upLineOrSearch() |
|
LineReader |
variable(String name,
Object value) |
|
protected boolean |
viAddEol() |
|
protected boolean |
viAddNext() |
|
protected boolean |
viBackwardBlankWord() |
|
protected boolean |
viBackwardBlankWordEnd() |
|
protected boolean |
viBackwardChar() |
|
protected boolean |
viBackwardDeleteChar() |
Deletes the previous character from the cursor position
|
protected boolean |
viBackwardKillWord() |
|
protected boolean |
viBackwardWord() |
|
protected boolean |
viBackwardWordEnd() |
|
protected boolean |
viBeginningOfLine() |
|
protected boolean |
viChange() |
|
protected boolean |
viChange(int startPos,
int endPos) |
|
protected boolean |
viChangeEol() |
|
protected boolean |
viChangeWholeLine() |
|
KeyMap<Binding> |
viCmd() |
|
protected boolean |
viCmdMode() |
|
protected boolean |
viDelete() |
|
protected String |
viDeleteChangeYankToRemap(String op) |
This method is calling while doing a delete-to ("d"), change-to ("c"),
or yank-to ("y") and it filters out only those movement operations
that are allowable during those operations.
|
protected boolean |
viDeleteChar() |
Deletes the character you are sitting on and sucks the rest of
the line in from the right.
|
protected boolean |
viDeleteTo(int startPos,
int endPos) |
|
protected boolean |
viDigitOrBeginningOfLine() |
|
protected boolean |
viDownLineOrHistory() |
|
protected boolean |
viEndOfLine() |
|
protected boolean |
viFindNextChar() |
|
protected boolean |
viFindNextCharSkip() |
|
protected boolean |
viFindPrevChar() |
|
protected boolean |
viFindPrevCharSkip() |
|
protected boolean |
viFirstNonBlank() |
|
protected boolean |
viForwardBlankWord() |
|
protected boolean |
viForwardBlankWordEnd() |
|
protected boolean |
viForwardChar() |
|
protected boolean |
viForwardWord() |
|
protected boolean |
viForwardWordEnd() |
|
protected boolean |
viHistorySearchBackward() |
|
protected boolean |
viHistorySearchForward() |
Implements vi search ("/" or "?").
|
protected boolean |
viInsert() |
|
protected boolean |
viInsertBol() |
|
protected boolean |
viInsertComment() |
|
KeyMap<Binding> |
viInsertion() |
|
protected boolean |
viJoin() |
|
protected boolean |
viKillEol() |
|
protected boolean |
viKillWholeLine() |
|
protected boolean |
viMatchBracket() |
|
protected boolean |
viOpenLineAbove() |
|
protected boolean |
viOpenLineBelow() |
|
KeyMap<Binding> |
viOpp() |
|
protected boolean |
viPutAfter() |
Pasts the yank buffer to the right of the current cursor position
and moves the cursor to the end of the pasted region.
|
protected boolean |
viPutBefore() |
|
protected boolean |
viRepeatFind() |
|
protected boolean |
viRepeatSearch() |
|
protected boolean |
viReplaceChars() |
Implements the vi change character command (in move-mode "r"
followed by the character to change to).
|
protected boolean |
viRevRepeatFind() |
|
protected boolean |
viRevRepeatSearch() |
|
KeyMap<Binding> |
visual() |
|
protected boolean |
visualLineMode() |
|
protected boolean |
visualMode() |
|
protected boolean |
viSwapCase() |
Switches the case of the current character from upper to lower
or lower to upper as necessary and advances the cursor one
position to the right.
|
protected boolean |
viUpLineOrHistory() |
|
protected boolean |
viYankTo() |
|
protected boolean |
viYankTo(int startPos,
int endPos) |
Implement the "vi" yank-to operation.
|
protected boolean |
viYankWholeLine() |
|
protected boolean |
whatCursorPosition() |
|
boolean |
yank() |
|
boolean |
yankPop() |
public static final char NULL_MASK
public static final int TAB_WIDTH
public static final String DEFAULT_WORDCHARS
public static final String DEFAULT_REMOVE_SUFFIX_CHARS
public static final String DEFAULT_COMMENT_BEGIN
public static final String DEFAULT_SEARCH_TERMINATORS
public static final String DEFAULT_BELL_STYLE
public static final int DEFAULT_LIST_MAX
public static final int DEFAULT_ERRORS
public static final long DEFAULT_BLINK_MATCHING_PAREN
public static final long DEFAULT_AMBIGUOUS_BINDING
public static final String DEFAULT_SECONDARY_PROMPT_PATTERN
public static final String DEFAULT_OTHERS_GROUP_NAME
public static final String DEFAULT_ORIGINAL_GROUP_NAME
public static final String DEFAULT_COMPLETION_STYLE_STARTING
public static final String DEFAULT_COMPLETION_STYLE_DESCRIPTION
public static final String DEFAULT_COMPLETION_STYLE_GROUP
public static final String DEFAULT_COMPLETION_STYLE_SELECTION
public static final int DEFAULT_INDENTATION
public static final int DEFAULT_FEATURES_MAX_BUFFER_SIZE
public static final String BRACKETED_PASTE_ON
public static final String BRACKETED_PASTE_OFF
public static final String BRACKETED_PASTE_BEGIN
public static final String BRACKETED_PASTE_END
public static final String FOCUS_IN_SEQ
public static final String FOCUS_OUT_SEQ
protected final Terminal terminal
protected final String appName
protected History history
protected Completer completer
protected Highlighter highlighter
protected Parser parser
protected Expander expander
protected final Map<LineReader.Option,Boolean> options
protected final Buffer buf
protected String tailTip
protected LineReader.SuggestionType autosuggestion
protected final Size size
protected AttributedString prompt
protected AttributedString rightPrompt
protected MaskingCallback maskingCallback
protected Buffer historyBuffer
protected CharSequence searchBuffer
protected StringBuffer searchTerm
protected boolean searchFailing
protected boolean searchBackward
protected int searchIndex
protected boolean doAutosuggestion
protected final BindingReader bindingReader
protected int findChar
protected int findDir
protected int findTailAdd
protected int regionMark
protected LineReader.RegionType regionActive
protected String yankBuffer
protected LineReaderImpl.ViMoveMode viMoveMode
protected KillRing killRing
protected boolean isUndo
protected final ReentrantLock lock
protected LineReaderImpl.State state
protected final AtomicBoolean startedReading
protected boolean reading
protected Supplier<AttributedString> post
protected int count
protected int mult
protected int universal
protected int repeatCount
protected boolean isArgDigit
protected ParsedLine parsedLine
protected boolean skipRedisplay
protected Display display
protected boolean overTyping
protected String keyMap
protected int smallTerminalOffset
protected boolean nextCommandFromHistory
protected int nextHistoryId
public LineReaderImpl(Terminal terminal) throws IOException
IOException
public LineReaderImpl(Terminal terminal, String appName) throws IOException
IOException
public Terminal getTerminal()
getTerminal
in interface LineReader
public String getAppName()
getAppName
in interface LineReader
public Map<String,KeyMap<Binding>> getKeyMaps()
getKeyMaps
in interface LineReader
public KeyMap<Binding> getKeys()
getKeys
in interface LineReader
public Map<String,Widget> getWidgets()
getWidgets
in interface LineReader
public Map<String,Widget> getBuiltinWidgets()
getBuiltinWidgets
in interface LineReader
public Buffer getBuffer()
getBuffer
in interface LineReader
public void setAutosuggestion(LineReader.SuggestionType type)
setAutosuggestion
in interface LineReader
public LineReader.SuggestionType getAutosuggestion()
getAutosuggestion
in interface LineReader
public String getTailTip()
getTailTip
in interface LineReader
public void setTailTip(String tailTip)
setTailTip
in interface LineReader
public void runMacro(String macro)
LineReader
Terminal.getCursorPosition(IntConsumer)
.runMacro
in interface LineReader
macro
- the key sequence to push backTerminal.getCursorPosition(IntConsumer)
,
LineReader.readMouseEvent()
public MouseEvent readMouseEvent()
LineReader
InfoCmp.Capability.key_mouse
sequence
has just been read on the input stream.
Compared to Terminal.readMouseEvent()
, this method takes into account keys
that have been pushed back using LineReader.runMacro(String)
.readMouseEvent
in interface LineReader
LineReader.runMacro(String)
,
Terminal.getCursorPosition(IntConsumer)
public void setCompleter(Completer completer)
completer
- the completer to usepublic Completer getCompleter()
public void setHistory(History history)
public History getHistory()
getHistory
in interface LineReader
public void setHighlighter(Highlighter highlighter)
public Highlighter getHighlighter()
getHighlighter
in interface LineReader
public Parser getParser()
getParser
in interface LineReader
public void setParser(Parser parser)
public Expander getExpander()
getExpander
in interface LineReader
public void setExpander(Expander expander)
public String readLine() throws UserInterruptException, EndOfFileException
readLine
in interface LineReader
UserInterruptException
- If the call was interrupted by the user.EndOfFileException
- If the end of the input stream was reached.public String readLine(Character mask) throws UserInterruptException, EndOfFileException
readLine
in interface LineReader
mask
- The mask character, null
or 0
.UserInterruptException
- If the call was interrupted by the user.EndOfFileException
- If the end of the input stream was reached.public String readLine(String prompt) throws UserInterruptException, EndOfFileException
InputStream
, and return the line
(without any trailing newlines).readLine
in interface LineReader
prompt
- The prompt to issue to the terminal, may be null.UserInterruptException
- If the call was interrupted by the user.EndOfFileException
- If the end of the input stream was reached.public String readLine(String prompt, Character mask) throws UserInterruptException, EndOfFileException
InputStream
, and return the line
(without any trailing newlines).readLine
in interface LineReader
prompt
- The prompt to issue to the terminal, may be null.mask
- The mask character, null
or 0
.UserInterruptException
- If the call was interrupted by the user.EndOfFileException
- If the end of the input stream was reached.public String readLine(String prompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException
InputStream
, and return the line
(without any trailing newlines).readLine
in interface LineReader
prompt
- The prompt to issue to the terminal, may be null.mask
- The mask character, null
or 0
.buffer
- A string that will be set for editing.UserInterruptException
- If the call was interrupted by the user.EndOfFileException
- If the end of the input stream was reached.public String readLine(String prompt, String rightPrompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException
InputStream
, and return the line
(without any trailing newlines).readLine
in interface LineReader
prompt
- The prompt to issue to the terminal, may be null.rightPrompt
- The prompt to issue to the right of the terminal, may be null.mask
- The mask character, null
or 0
.buffer
- A string that will be set for editing.UserInterruptException
- if readLine was interrupted (using Ctrl-C for example)EndOfFileException
- if an EOF has been found (using Ctrl-D for example)public String readLine(String prompt, String rightPrompt, MaskingCallback maskingCallback, String buffer) throws UserInterruptException, EndOfFileException
InputStream
, and return the line
(without any trailing newlines).readLine
in interface LineReader
prompt
- The prompt to issue to the terminal, may be null.rightPrompt
- The prompt to issue to the right of the terminal, may be null.maskingCallback
- The callback used to mask parts of the edited line.buffer
- A string that will be set for editing.UserInterruptException
- if readLine was interrupted (using Ctrl-C for example)EndOfFileException
- if an EOF has been found (using Ctrl-D for example)public void printAbove(String str)
LineReader
printAbove
in interface LineReader
str
- the string to printLineReader.printAbove(AttributedString)
public void printAbove(AttributedString str)
LineReader
printAbove
in interface LineReader
str
- the string to printLineReader.printAbove(String)
public boolean isReading()
LineReader
readLine()
call.isReading
in interface LineReader
true
if there is an ongoing readLine()
call.protected boolean freshLine()
public void callWidget(String name)
callWidget
in interface LineReader
public boolean redrawLine()
true
public void putString(CharSequence str)
str
- the char sequence to write in the bufferpublic void flush()
public boolean isKeyMap(String name)
public int readCharacter()
public int peekCharacter(long timeout)
public Binding readBinding(KeyMap<Binding> keys)
keys
- the KeyMap to use for decoding the input streamnull
if the end of
stream has been reachedpublic ParsedLine getParsedLine()
getParsedLine
in interface LineReader
public String getLastBinding()
getLastBinding
in interface LineReader
public String getSearchTerm()
getSearchTerm
in interface LineReader
public LineReader.RegionType getRegionActive()
getRegionActive
in interface LineReader
public int getRegionMark()
getRegionMark
in interface LineReader
public boolean setKeyMap(String name)
setKeyMap
in interface LineReader
name
- The name of the keymap to switch topublic String getKeyMap()
getKeyMap
in interface LineReader
setKeyMap(String)
.public LineReader variable(String name, Object value)
variable
in interface LineReader
public Map<String,Object> getVariables()
getVariables
in interface LineReader
public Object getVariable(String name)
getVariable
in interface LineReader
public void setVariable(String name, Object value)
setVariable
in interface LineReader
public LineReader option(LineReader.Option option, boolean value)
option
in interface LineReader
public boolean isSet(LineReader.Option option)
isSet
in interface LineReader
public void setOpt(LineReader.Option option)
setOpt
in interface LineReader
public void unsetOpt(LineReader.Option option)
unsetOpt
in interface LineReader
public void addCommandsInBuffer(Collection<String> commands)
addCommandsInBuffer
in interface LineReader
public void editAndAddInBuffer(File file) throws Exception
editAndAddInBuffer
in interface LineReader
Exception
protected String finishBuffer()
protected void handleSignal(Terminal.Signal signal)
public void setPrompt(String prompt)
public void setRightPrompt(String rightPrompt)
protected void setBuffer(Buffer buffer)
protected void setBuffer(String buffer)
String
. The
visual terminal will be modified to show the current buffer.buffer
- the new contents of the buffer.protected String viDeleteChangeYankToRemap(String op)
op
- The incoming operation to remapprotected int switchCase(int ch)
protected boolean isInViMoveOperation()
protected boolean isInViChangeOperation()
protected boolean isInViCmdMode()
protected boolean viForwardChar()
protected boolean viBackwardChar()
protected boolean forwardWord()
protected boolean viForwardWord()
protected boolean viForwardBlankWord()
protected boolean emacsForwardWord()
protected boolean viForwardBlankWordEnd()
protected boolean viForwardWordEnd()
protected boolean backwardWord()
protected boolean viBackwardWord()
protected boolean viBackwardBlankWord()
protected boolean viBackwardWordEnd()
protected boolean viBackwardBlankWordEnd()
protected boolean emacsBackwardWord()
protected boolean backwardDeleteWord()
protected boolean viBackwardKillWord()
protected boolean backwardKillWord()
protected boolean copyPrevWord()
protected boolean upCaseWord()
protected boolean downCaseWord()
protected boolean capitalizeWord()
protected boolean deleteWord()
protected boolean killWord()
protected boolean transposeWords()
protected boolean insertComment()
protected boolean viInsertComment()
protected boolean doInsertComment(boolean isViMode)
protected boolean viFindNextChar()
protected boolean viFindPrevChar()
protected boolean viFindNextCharSkip()
protected boolean viFindPrevCharSkip()
protected boolean viRepeatFind()
protected boolean viRevRepeatFind()
protected boolean viHistorySearchForward()
true
if the search was successfulprotected boolean viHistorySearchBackward()
protected boolean viRepeatSearch()
protected boolean viRevRepeatSearch()
protected boolean insertCloseCurly()
protected boolean insertCloseParen()
protected boolean insertCloseSquare()
protected boolean insertClose(String s)
protected boolean viMatchBracket()
protected boolean undefinedKey()
protected boolean doViMatchBracket()
protected int getBracketType(int ch)
ch
- The character to checkprotected boolean transposeChars()
protected boolean undo()
protected boolean redo()
protected boolean sendBreak()
protected boolean backwardChar()
protected boolean forwardChar()
protected boolean viDigitOrBeginningOfLine()
protected boolean universalArgument()
protected boolean argumentBase()
protected boolean negArgument()
protected boolean digitArgument()
protected boolean viDelete()
protected boolean viYankTo()
protected boolean viYankWholeLine()
protected boolean viChange()
protected void cleanup()
protected void doCleanup(boolean nl)
protected boolean historyIncrementalSearchForward()
protected boolean historyIncrementalSearchBackward()
protected boolean doSearchHistory(boolean backward)
protected boolean historySearchForward()
protected boolean historySearchBackward()
public int searchBackwards(String searchTerm, int startIndex)
searchTerm
- substring to search for.startIndex
- the index from which on to searchpublic int searchBackwards(String searchTerm)
searchTerm
- substring to search for.public int searchBackwards(String searchTerm, int startIndex, boolean startsWith)
public int searchForwards(String searchTerm, int startIndex, boolean startsWith)
public int searchForwards(String searchTerm, int startIndex)
searchTerm
- substring to search for.startIndex
- the index from which on to searchpublic int searchForwards(String searchTerm)
searchTerm
- substring to search for.protected boolean quit()
protected boolean acceptAndHold()
protected boolean acceptLineAndDownHistory()
protected boolean acceptAndInferNextHistory()
protected boolean acceptLine()
protected boolean selfInsert()
protected boolean selfInsertUnmeta()
protected boolean overwriteMode()
protected boolean beginningOfBufferOrHistory()
protected boolean beginningOfHistory()
protected boolean endOfBufferOrHistory()
protected boolean endOfHistory()
protected boolean beginningOfLineHist()
protected boolean endOfLineHist()
protected boolean upHistory()
protected boolean downHistory()
protected boolean viUpLineOrHistory()
protected boolean viDownLineOrHistory()
protected boolean upLine()
protected boolean downLine()
protected boolean upLineOrHistory()
protected boolean upLineOrSearch()
protected boolean downLineOrHistory()
protected boolean downLineOrSearch()
protected boolean viCmdMode()
protected boolean viInsert()
protected boolean viAddNext()
protected boolean viAddEol()
protected boolean emacsEditingMode()
protected boolean viChangeWholeLine()
protected boolean viChangeEol()
protected boolean viKillEol()
protected boolean quotedInsert()
protected boolean viJoin()
protected boolean viKillWholeLine()
protected boolean viInsertBol()
protected boolean backwardDeleteChar()
protected boolean viFirstNonBlank()
protected boolean viBeginningOfLine()
protected boolean viEndOfLine()
protected boolean beginningOfLine()
protected boolean endOfLine()
protected boolean deleteChar()
protected boolean viBackwardDeleteChar()
true
if it succeeded, false
otherwiseprotected boolean viDeleteChar()
true
if it succeeded, false
otherwiseprotected boolean viSwapCase()
true
if it succeeded, false
otherwiseprotected boolean viReplaceChars()
true
if it succeeded, false
otherwiseprotected boolean viChange(int startPos, int endPos)
protected boolean viDeleteTo(int startPos, int endPos)
protected boolean doViDeleteOrChange(int startPos, int endPos, boolean isChange)
startPos
- The start positionendPos
- The end position.isChange
- If true, then the delete is part of a change operationg
(e.g. "c$" is change-to-end-of line, so we first must delete to end
of line to start the changetrue
if it succeeded, false
otherwiseprotected boolean viYankTo(int startPos, int endPos)
startPos
- The starting position from which to yankendPos
- The ending position to which to yanktrue
if the yank succeededprotected boolean viOpenLineAbove()
protected boolean viOpenLineBelow()
protected boolean viPutAfter()
true
protected boolean viPutBefore()
protected boolean doLowercaseVersion()
protected boolean setMarkCommand()
protected boolean exchangePointAndMark()
protected boolean visualMode()
protected boolean visualLineMode()
protected boolean deactivateRegion()
protected boolean whatCursorPosition()
protected boolean editAndExecute()
public boolean redisplay()
protected void redisplay(boolean flush)
public AttributedString getDisplayedBufferWithPrompts(List<AttributedString> secondaryPrompts)
secondaryPrompts
- a list to store the secondary promptsprotected boolean insertTab()
protected boolean expandHistory()
protected boolean expandWord()
protected boolean expandOrComplete()
protected boolean expandOrCompletePrefix()
protected boolean completeWord()
protected boolean menuComplete()
protected boolean menuExpandOrComplete()
protected boolean completePrefix()
protected boolean listChoices()
protected boolean deleteCharOrList()
protected boolean doComplete(LineReaderImpl.CompletionType lst, boolean useMenu, boolean prefix)
protected boolean doComplete(LineReaderImpl.CompletionType lst, boolean useMenu, boolean prefix, boolean forSuggestion)
protected Comparator<Candidate> getCandidateComparator(boolean caseInsensitive, String word)
protected String getOthersGroupName()
protected String getOriginalGroupName()
protected Comparator<String> getGroupComparator()
protected boolean nextBindingIsComplete()
protected boolean doMenu(List<Candidate> original, String completed, BiFunction<CharSequence,Boolean,CharSequence> escaper)
protected boolean clearChoices()
protected boolean doList(List<Candidate> possible, String completed, boolean runLoop, BiFunction<CharSequence,Boolean,CharSequence> escaper)
protected boolean doList(List<Candidate> possible, String completed, boolean runLoop, BiFunction<CharSequence,Boolean,CharSequence> escaper, boolean forSuggestion)
protected LineReaderImpl.PostResult computePost(List<Candidate> possible, Candidate selection, List<Candidate> ordered, String completed)
protected LineReaderImpl.PostResult computePost(List<Candidate> possible, Candidate selection, List<Candidate> ordered, String completed, Function<String,Integer> wcwidth, int width, boolean autoGroup, boolean groupName, boolean rowsFirst)
protected LineReaderImpl.PostResult toColumns(List<Object> items, Candidate selection, String completed, Function<String,Integer> wcwidth, int width, boolean rowsFirst)
protected void toColumns(Object items, int width, int maxWidth, AttributedStringBuilder sb, Candidate selection, String completed, boolean rowsFirst, int[] out)
protected AttributedStyle getCompletionStyleDescription()
protected AttributedStyle getCompletionStyleGroup()
protected AttributedStyle getCompletionStyleSelection()
protected AttributedStyle getCompletionStyle(String name, String value)
protected AttributedStyle buildStyle(String str)
protected boolean moveHistory(boolean next, int count)
next
- If true, move forwardcount
- The number of entries to moveprotected boolean moveHistory(boolean next)
next
- true
to go to the next, false
for the previous.true
if successful, false
otherwiseprotected boolean killBuffer()
protected boolean killWholeLine()
public boolean killLine()
public boolean backwardKillLine()
public boolean killRegion()
public boolean copyRegionAsKill()
public boolean yank()
public boolean yankPop()
public boolean mouse()
public boolean beginPaste()
public boolean focusIn()
public boolean focusOut()
public boolean clear()
true
public boolean clearScreen()
true
public boolean beep()
true
protected boolean isDelimiter(int c)
c
- The character to testprotected boolean isWhitespace(int c)
Character.isWhitespace(char)
, however
eventually it should be hooked up so that the definition of whitespace
can be configured, as readline does.c
- The character to checkprotected boolean isViAlphaNum(int c)
protected boolean isAlpha(int c)
protected boolean isWord(int c)
public Map<String,KeyMap<Binding>> defaultKeyMaps()
defaultKeyMaps
in interface LineReader
Copyright © 2020. All rights reserved.