public class LineReaderImpl extends Object implements LineReader, Flushable
Modifier and Type | Class and Description |
---|---|
protected static class |
LineReaderImpl.BellType |
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
ACCEPT_LINE, AMBIGUOUS_BINDING, ARGUMENT_BASE, BACKWARD_CHAR, BACKWARD_DELETE_CHAR, BACKWARD_DELETE_WORD, BACKWARD_KILL_LINE, BACKWARD_KILL_WORD, BACKWARD_WORD, BEEP, 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_SCREEN, COMMENT_BEGIN, COMPLETE_PREFIX, COMPLETE_WORD, 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, 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, FORWARD_CHAR, FORWARD_WORD, 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, 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, NEG_ARGUMENT, OVERWRITE_MODE, PREFER_VISIBLE_BELL, PUT_REPLACE_SELECTION, QUOTED_INSERT, READ_COMMAND, RECURSIVE_EDIT, REDISPLAY, REDO, 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 and Description |
---|
LineReaderImpl(Terminal terminal) |
LineReaderImpl(Terminal terminal,
String appName) |
LineReaderImpl(Terminal terminal,
String appName,
Map<String,Object> variables) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptLine() |
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() |
protected Map<String,Widget> |
builtinWidgets() |
void |
callWidget(String name) |
protected boolean |
capitalizeWord() |
protected void |
cleanup() |
boolean |
clearScreen()
Clear the screen by issuing the ANSI "clear screen" code.
|
protected boolean |
completePrefix() |
protected boolean |
completeWord() |
protected org.jline.reader.impl.LineReaderImpl.PostResult |
computePost(List<Candidate> possible,
Candidate selection,
List<Candidate> ordered,
String completed) |
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 boolean |
doComplete(org.jline.reader.impl.LineReaderImpl.CompletionType lst,
boolean useMenu,
boolean prefix) |
protected boolean |
doInsertComment(boolean isViMode) |
protected boolean |
doList(List<Candidate> possible,
String completed,
boolean runLoop) |
protected boolean |
doLowercaseVersion() |
protected boolean |
doMenu(List<Candidate> original,
String completed) |
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() |
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 |
finishBuffer()
Clear the buffer and add its contents to the history.
|
void |
flush()
Flush the terminal output stream.
|
protected boolean |
forwardChar() |
protected boolean |
forwardWord() |
String |
getAppName() |
protected int |
getBracketType(int ch)
Given a character determines what type of bracket it is (paren,
square, curly, or none).
|
BufferImpl |
getBuffer() |
Map<String,Widget> |
getBuiltinWidgets() |
Completer |
getCompleter()
Returns the completer.
|
Expander |
getExpander() |
Highlighter |
getHighlighter() |
History |
getHistory() |
String |
getKeyMap()
Returns the name of the current key mapping.
|
Map<String,KeyMap<Binding>> |
getKeyMaps() |
KeyMap<Binding> |
getKeys() |
String |
getLastBinding() |
ParsedLine |
getParsedLine() |
Parser |
getParser() |
LineReader.RegionType |
getRegionActive() |
int |
getRegionMark() |
String |
getSearchTerm() |
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 |
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() |
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() |
protected boolean |
overwriteMode() |
boolean |
pasteFromClipboard()
Paste the contents of the clipboard into the terminal buffer
|
int |
peekCharacter(long timeout) |
void |
printSearchStatus(String searchTerm,
String match,
boolean backward) |
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 the next line with the specified prompt.
|
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). |
boolean |
redisplay() |
protected void |
redisplay(boolean flush) |
protected boolean |
redo() |
void |
redrawLine()
Clear the line and redraw it.
|
void |
runMacro(String macro) |
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() |
protected void |
setBuffer(BufferImpl buffer) |
protected void |
setBuffer(String buffer)
Set the current buffer's content to the specified
String . |
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) |
protected void |
setPrompt(String prompt) |
protected void |
setRightPrompt(String rightPrompt) |
void |
setVariable(String name,
Object value) |
protected int |
switchCase(int ch) |
protected org.jline.reader.impl.LineReaderImpl.PostResult |
toColumns(List<Object> items,
Candidate selection,
String completed) |
protected void |
toColumns(Object items,
int width,
int maxWidth,
AttributedStringBuilder sb,
Candidate selection,
String completed,
int[] out) |
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() |
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 |
viKillEol() |
protected boolean |
viKillWholeLine() |
protected boolean |
viMatchBracket() |
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 |
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 |
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
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 BufferImpl buf
protected final Size size
protected AttributedString prompt
protected AttributedString rightPrompt
protected Character mask
protected BufferImpl historyBuffer
protected CharSequence searchBuffer
protected StringBuffer searchTerm
protected int searchIndex
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 UndoTree<BufferImpl> undo
protected boolean isUndo
protected LineReaderImpl.State state
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
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()
public Map<String,KeyMap<Binding>> getKeyMaps()
getKeyMaps
in interface LineReader
public Map<String,Widget> getWidgets()
getWidgets
in interface LineReader
public Map<String,Widget> getBuiltinWidgets()
getBuiltinWidgets
in interface LineReader
public BufferImpl getBuffer()
getBuffer
in interface LineReader
public void runMacro(String macro)
runMacro
in interface LineReader
public void setCompleter(Completer completer)
public 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
EndOfFileException
public String readLine(Character mask) throws UserInterruptException, EndOfFileException
readLine
in interface LineReader
UserInterruptException
EndOfFileException
public String readLine(String prompt) throws UserInterruptException, EndOfFileException
LineReader
readLine(prompt, null, null)
readLine
in interface LineReader
UserInterruptException
EndOfFileException
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.UserInterruptException
EndOfFileException
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 character mask, may be null.buffer
- The default value presented to the user to edit, may be null.UserInterruptException
EndOfFileException
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 right prompt
This is a template, with optional '%'
escapes, as
described in the class header.mask
- The character mask, may be null.buffer
- The default value presented to the user to edit, may be null.UserInterruptException
- if readLine was interrupted (using Ctrl-C for example)EndOfFileException
- if an EOF has been found (using Ctrl-D for example)public void callWidget(String name)
callWidget
in interface LineReader
public void redrawLine()
public void putString(CharSequence str)
public 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()
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)
name
- The name of the keymap to switch topublic String getKeyMap()
setKeyMap(String)
.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 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
protected String finishBuffer()
protected void handleSignal(Terminal.Signal signal)
protected void setPrompt(String prompt)
protected void setRightPrompt(String rightPrompt)
protected void setBuffer(BufferImpl 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()
protected 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 viChange()
protected void cleanup()
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 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 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()
protected boolean viDeleteChar()
protected boolean viSwapCase()
protected boolean viReplaceChars()
protected 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 changeprotected boolean viYankTo(int startPos, int endPos)
startPos
- The starting position from which to yankendPos
- The ending position to which to yankprotected boolean viPutAfter()
protected boolean doLowercaseVersion()
protected boolean setMarkCommand()
protected boolean exchangePointAndMark()
protected boolean visualMode()
protected boolean visualLineMode()
protected boolean deactivateRegion()
protected boolean whatCursorPosition()
public boolean redisplay()
protected void redisplay(boolean flush)
protected 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(org.jline.reader.impl.LineReaderImpl.CompletionType lst, boolean useMenu, boolean prefix)
protected boolean nextBindingIsComplete()
protected org.jline.reader.impl.LineReaderImpl.PostResult computePost(List<Candidate> possible, Candidate selection, List<Candidate> ordered, String completed)
protected org.jline.reader.impl.LineReaderImpl.PostResult toColumns(List<Object> items, Candidate selection, String completed)
protected void toColumns(Object items, int width, int maxWidth, AttributedStringBuilder sb, Candidate selection, String completed, int[] out)
protected boolean moveHistory(boolean next, int count)
next
- If true, move forwardcount
- The number of entries to moveprotected boolean moveHistory(boolean next)
protected 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 clearScreen()
public boolean beep()
public boolean pasteFromClipboard()
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 © 2016. All rights reserved.