Class LineReaderImpl

java.lang.Object
org.jline.reader.impl.LineReaderImpl
All Implemented Interfaces:
Flushable, LineReader

public class LineReaderImpl extends Object implements LineReader, Flushable
A reader for terminal applications. It supports custom tab-completion, saveable command history, and command line editing.
Author:
Marc Prud'hommeaux, Jason Dillon, Guillaume Nodet
  • Field Details

  • Constructor Details

  • Method Details

    • getTerminal

      public Terminal getTerminal()
      Specified by:
      getTerminal in interface LineReader
    • getAppName

      public String getAppName()
      Specified by:
      getAppName in interface LineReader
    • getKeyMaps

      public Map<String,KeyMap<Binding>> getKeyMaps()
      Specified by:
      getKeyMaps in interface LineReader
    • getKeys

      public KeyMap<Binding> getKeys()
      Specified by:
      getKeys in interface LineReader
    • getWidgets

      public Map<String,Widget> getWidgets()
      Specified by:
      getWidgets in interface LineReader
    • getBuiltinWidgets

      public Map<String,Widget> getBuiltinWidgets()
      Specified by:
      getBuiltinWidgets in interface LineReader
    • getBuffer

      public Buffer getBuffer()
      Specified by:
      getBuffer in interface LineReader
    • setAutosuggestion

      public void setAutosuggestion(LineReader.SuggestionType type)
      Specified by:
      setAutosuggestion in interface LineReader
    • getAutosuggestion

      public LineReader.SuggestionType getAutosuggestion()
      Specified by:
      getAutosuggestion in interface LineReader
    • getTailTip

      public String getTailTip()
      Specified by:
      getTailTip in interface LineReader
    • setTailTip

      public void setTailTip(String tailTip)
      Specified by:
      setTailTip in interface LineReader
    • runMacro

      public void runMacro(String macro)
      Description copied from interface: LineReader
      Push back a key sequence that will be later consumed by the line reader. This method can be used after reading the cursor position using Terminal.getCursorPosition(IntConsumer).
      Specified by:
      runMacro in interface LineReader
      Parameters:
      macro - the key sequence to push back
      See Also:
    • readMouseEvent

      public MouseEvent readMouseEvent()
      Description copied from interface: LineReader
      Read a mouse event when the 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).
      Specified by:
      readMouseEvent in interface LineReader
      Returns:
      the mouse event
      See Also:
    • setCompleter

      public void setCompleter(Completer completer)
      Set the completer.
      Parameters:
      completer - the completer to use
    • getCompleter

      public Completer getCompleter()
      Returns the completer.
      Returns:
      the completer
    • setHistory

      public void setHistory(History history)
    • getHistory

      public History getHistory()
      Specified by:
      getHistory in interface LineReader
    • setHighlighter

      public void setHighlighter(Highlighter highlighter)
    • getHighlighter

      public Highlighter getHighlighter()
      Specified by:
      getHighlighter in interface LineReader
    • getParser

      public Parser getParser()
      Specified by:
      getParser in interface LineReader
    • setParser

      public void setParser(Parser parser)
    • getExpander

      public Expander getExpander()
      Specified by:
      getExpander in interface LineReader
    • setExpander

      public void setExpander(Expander expander)
    • setCompletionMatcher

      public void setCompletionMatcher(CompletionMatcher completionMatcher)
    • readLine

      Read the next line and return the contents of the buffer.
      Specified by:
      readLine in interface LineReader
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      Read the next line with the specified character mask. If null, then characters will be echoed. If 0, then no characters will be echoed.
      Specified by:
      readLine in interface LineReader
      Parameters:
      mask - The mask character, null or 0.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      public String readLine(String prompt) throws UserInterruptException, EndOfFileException
      Read a line from the in InputStream, and return the line (without any trailing newlines).
      Specified by:
      readLine in interface LineReader
      Parameters:
      prompt - The prompt to issue to the terminal, may be null.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      public String readLine(String prompt, Character mask) throws UserInterruptException, EndOfFileException
      Read a line from the in InputStream, and return the line (without any trailing newlines).
      Specified by:
      readLine in interface LineReader
      Parameters:
      prompt - The prompt to issue to the terminal, may be null.
      mask - The mask character, null or 0.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      public String readLine(String prompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException
      Read a line from the in InputStream, and return the line (without any trailing newlines).
      Specified by:
      readLine in interface LineReader
      Parameters:
      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.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      public String readLine(String prompt, String rightPrompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException
      Read a line from the in InputStream, and return the line (without any trailing newlines).
      Specified by:
      readLine in interface LineReader
      Parameters:
      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.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • readLine

      public String readLine(String prompt, String rightPrompt, MaskingCallback maskingCallback, String buffer) throws UserInterruptException, EndOfFileException
      Read a line from the in InputStream, and return the line (without any trailing newlines).
      Specified by:
      readLine in interface LineReader
      Parameters:
      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.
      Returns:
      A line that is read from the terminal, can never be null.
      Throws:
      UserInterruptException - if readLine was interrupted (using Ctrl-C for example)
      EndOfFileException - if an EOF has been found (using Ctrl-D for example)
    • printAbove

      public void printAbove(String str)
      Description copied from interface: LineReader
      Prints a line above the prompt and redraw everything. If the LineReader is not actually reading a line, the string will simply be printed to the terminal.
      Specified by:
      printAbove in interface LineReader
      Parameters:
      str - the string to print
      See Also:
    • printAbove

      public void printAbove(AttributedString str)
      Description copied from interface: LineReader
      Prints a string before the prompt and redraw everything. If the LineReader is not actually reading a line, the string will simply be printed to the terminal.
      Specified by:
      printAbove in interface LineReader
      Parameters:
      str - the string to print
      See Also:
    • isReading

      public boolean isReading()
      Description copied from interface: LineReader
      Check if a thread is currently in a readLine() call.
      Specified by:
      isReading in interface LineReader
      Returns:
      true if there is an ongoing readLine() call.
    • freshLine

      protected boolean freshLine()
    • callWidget

      public void callWidget(String name)
      Specified by:
      callWidget in interface LineReader
    • redrawLine

      public boolean redrawLine()
      Clear the line and redraw it.
      Returns:
      true
    • putString

      public void putString(CharSequence str)
      Write out the specified string to the buffer and the output stream.
      Parameters:
      str - the char sequence to write in the buffer
    • flush

      public void flush()
      Flush the terminal output stream. This is important for printout out single characters (like a buf.backspace or keyboard) that we want the terminal to handle immediately.
      Specified by:
      flush in interface Flushable
    • isKeyMap

      public boolean isKeyMap(String name)
    • readCharacter

      public int readCharacter()
      Read a character from the terminal.
      Returns:
      the character, or -1 if an EOF is received.
    • peekCharacter

      public int peekCharacter(long timeout)
    • doReadBinding

      protected <T> T doReadBinding(KeyMap<T> keys, KeyMap<T> local)
    • doReadStringUntil

      protected String doReadStringUntil(String sequence)
    • readBinding

      public Binding readBinding(KeyMap<Binding> keys)
      Read from the input stream and decode an operation from the key map. The input stream will be read character by character until a matching binding can be found. Characters that can't possibly be matched to any binding will be discarded.
      Parameters:
      keys - the KeyMap to use for decoding the input stream
      Returns:
      the decoded binding or null if the end of stream has been reached
    • readBinding

      public Binding readBinding(KeyMap<Binding> keys, KeyMap<Binding> local)
    • getParsedLine

      public ParsedLine getParsedLine()
      Specified by:
      getParsedLine in interface LineReader
    • getLastBinding

      public String getLastBinding()
      Specified by:
      getLastBinding in interface LineReader
    • getSearchTerm

      public String getSearchTerm()
      Specified by:
      getSearchTerm in interface LineReader
    • getRegionActive

      public LineReader.RegionType getRegionActive()
      Specified by:
      getRegionActive in interface LineReader
    • getRegionMark

      public int getRegionMark()
      Specified by:
      getRegionMark in interface LineReader
    • setKeyMap

      public boolean setKeyMap(String name)
      Sets the current keymap by name. Supported keymaps are "emacs", "viins", "vicmd".
      Specified by:
      setKeyMap in interface LineReader
      Parameters:
      name - The name of the keymap to switch to
      Returns:
      true if the keymap was set, or false if the keymap is not recognized.
    • getKeyMap

      public String getKeyMap()
      Returns the name of the current key mapping.
      Specified by:
      getKeyMap in interface LineReader
      Returns:
      the name of the key mapping. This will be the canonical name of the current mode of the key map and may not reflect the name that was used with setKeyMap(String).
    • variable

      public LineReader variable(String name, Object value)
      Specified by:
      variable in interface LineReader
    • getVariables

      public Map<String,Object> getVariables()
      Specified by:
      getVariables in interface LineReader
    • getVariable

      public Object getVariable(String name)
      Specified by:
      getVariable in interface LineReader
    • setVariable

      public void setVariable(String name, Object value)
      Specified by:
      setVariable in interface LineReader
    • option

      public LineReader option(LineReader.Option option, boolean value)
      Specified by:
      option in interface LineReader
    • isSet

      public boolean isSet(LineReader.Option option)
      Specified by:
      isSet in interface LineReader
    • setOpt

      public void setOpt(LineReader.Option option)
      Specified by:
      setOpt in interface LineReader
    • unsetOpt

      public void unsetOpt(LineReader.Option option)
      Specified by:
      unsetOpt in interface LineReader
    • addCommandsInBuffer

      public void addCommandsInBuffer(Collection<String> commands)
      Specified by:
      addCommandsInBuffer in interface LineReader
    • editAndAddInBuffer

      public void editAndAddInBuffer(File file) throws Exception
      Specified by:
      editAndAddInBuffer in interface LineReader
      Throws:
      Exception
    • getTabWidth

      protected int getTabWidth()
    • finishBuffer

      protected String finishBuffer()
      Clear the buffer and add its contents to the history.
      Returns:
      the former contents of the buffer.
    • finish

      protected String finish(String str)
    • handleSignal

      protected void handleSignal(Terminal.Signal signal)
    • getWidget

      protected Widget getWidget(Object binding)
    • setPrompt

      public void setPrompt(String prompt)
    • setRightPrompt

      public void setRightPrompt(String rightPrompt)
    • setBuffer

      protected void setBuffer(Buffer buffer)
    • setBuffer

      protected void setBuffer(String buffer)
      Set the current buffer's content to the specified String. The visual terminal will be modified to show the current buffer.
      Parameters:
      buffer - the new contents of the buffer.
    • viDeleteChangeYankToRemap

      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. Any operation that isn't allow drops you back into movement mode.
      Parameters:
      op - The incoming operation to remap
      Returns:
      The remaped operation
    • switchCase

      protected int switchCase(int ch)
    • isInViMoveOperation

      protected boolean isInViMoveOperation()
      Returns:
      true if line reader is in the middle of doing a change-to delete-to or yank-to.
    • isInViChangeOperation

      protected boolean isInViChangeOperation()
    • isInViCmdMode

      protected boolean isInViCmdMode()
    • viForwardChar

      protected boolean viForwardChar()
    • viBackwardChar

      protected boolean viBackwardChar()
    • forwardWord

      protected boolean forwardWord()
    • viForwardWord

      protected boolean viForwardWord()
    • viForwardBlankWord

      protected boolean viForwardBlankWord()
    • emacsForwardWord

      protected boolean emacsForwardWord()
    • viForwardBlankWordEnd

      protected boolean viForwardBlankWordEnd()
    • viForwardWordEnd

      protected boolean viForwardWordEnd()
    • backwardWord

      protected boolean backwardWord()
    • viBackwardWord

      protected boolean viBackwardWord()
    • viBackwardBlankWord

      protected boolean viBackwardBlankWord()
    • viBackwardWordEnd

      protected boolean viBackwardWordEnd()
    • viBackwardBlankWordEnd

      protected boolean viBackwardBlankWordEnd()
    • emacsBackwardWord

      protected boolean emacsBackwardWord()
    • backwardDeleteWord

      protected boolean backwardDeleteWord()
    • viBackwardKillWord

      protected boolean viBackwardKillWord()
    • backwardKillWord

      protected boolean backwardKillWord()
    • copyPrevWord

      protected boolean copyPrevWord()
    • upCaseWord

      protected boolean upCaseWord()
    • downCaseWord

      protected boolean downCaseWord()
    • capitalizeWord

      protected boolean capitalizeWord()
    • deleteWord

      protected boolean deleteWord()
    • killWord

      protected boolean killWord()
    • transposeWords

      protected boolean transposeWords()
    • insertComment

      protected boolean insertComment()
    • viInsertComment

      protected boolean viInsertComment()
    • doInsertComment

      protected boolean doInsertComment(boolean isViMode)
    • viFindNextChar

      protected boolean viFindNextChar()
    • viFindPrevChar

      protected boolean viFindPrevChar()
    • viFindNextCharSkip

      protected boolean viFindNextCharSkip()
    • viFindPrevCharSkip

      protected boolean viFindPrevCharSkip()
    • viRepeatFind

      protected boolean viRepeatFind()
    • viRevRepeatFind

      protected boolean viRevRepeatFind()
    • viHistorySearchForward

      protected boolean viHistorySearchForward()
      Implements vi search ("/" or "?").
      Returns:
      true if the search was successful
    • viHistorySearchBackward

      protected boolean viHistorySearchBackward()
    • viRepeatSearch

      protected boolean viRepeatSearch()
    • viRevRepeatSearch

      protected boolean viRevRepeatSearch()
    • insertCloseCurly

      protected boolean insertCloseCurly()
    • insertCloseParen

      protected boolean insertCloseParen()
    • insertCloseSquare

      protected boolean insertCloseSquare()
    • insertClose

      protected boolean insertClose(String s)
    • viMatchBracket

      protected boolean viMatchBracket()
    • undefinedKey

      protected boolean undefinedKey()
    • doViMatchBracket

      protected boolean doViMatchBracket()
      Implements vi style bracket matching ("%" command). The matching bracket for the current bracket type that you are sitting on is matched.
      Returns:
      true if it worked, false if the cursor was not on a bracket character or if there was no matching bracket.
    • getBracketType

      protected int getBracketType(int ch)
      Given a character determines what type of bracket it is (paren, square, curly, or none).
      Parameters:
      ch - The character to check
      Returns:
      1 is square, 2 curly, 3 parent, or zero for none. The value will be negated if it is the closing form of the bracket.
    • transposeChars

      protected boolean transposeChars()
      Performs character transpose. The character prior to the cursor and the character under the cursor are swapped and the cursor is advanced one. Do not cross line breaks.
      Returns:
      true
    • undo

      protected boolean undo()
    • redo

      protected boolean redo()
    • sendBreak

      protected boolean sendBreak()
    • backwardChar

      protected boolean backwardChar()
    • forwardChar

      protected boolean forwardChar()
    • viDigitOrBeginningOfLine

      protected boolean viDigitOrBeginningOfLine()
    • universalArgument

      protected boolean universalArgument()
    • argumentBase

      protected boolean argumentBase()
    • negArgument

      protected boolean negArgument()
    • digitArgument

      protected boolean digitArgument()
    • viDelete

      protected boolean viDelete()
    • viYankTo

      protected boolean viYankTo()
    • viYankWholeLine

      protected boolean viYankWholeLine()
    • viChange

      protected boolean viChange()
    • cleanup

      protected void cleanup()
    • doCleanup

      protected void doCleanup(boolean nl)
    • historyIncrementalSearchForward

      protected boolean historyIncrementalSearchForward()
    • historyIncrementalSearchBackward

      protected boolean historyIncrementalSearchBackward()
    • doSearchHistory

      protected boolean doSearchHistory(boolean backward)
    • historySearchForward

      protected boolean historySearchForward()
    • historySearchBackward

      protected boolean historySearchBackward()
    • searchBackwards

      public int searchBackwards(String searchTerm, int startIndex)
      Search backward in history from a given position.
      Parameters:
      searchTerm - substring to search for.
      startIndex - the index from which on to search
      Returns:
      index where this substring has been found, or -1 else.
    • searchBackwards

      public int searchBackwards(String searchTerm)
      Search backwards in history from the current position.
      Parameters:
      searchTerm - substring to search for.
      Returns:
      index where the substring has been found, or -1 else.
    • searchBackwards

      public int searchBackwards(String searchTerm, int startIndex, boolean startsWith)
    • searchForwards

      public int searchForwards(String searchTerm, int startIndex, boolean startsWith)
    • searchForwards

      public int searchForwards(String searchTerm, int startIndex)
      Search forward in history from a given position.
      Parameters:
      searchTerm - substring to search for.
      startIndex - the index from which on to search
      Returns:
      index where this substring has been found, or -1 else.
    • searchForwards

      public int searchForwards(String searchTerm)
      Search forwards in history from the current position.
      Parameters:
      searchTerm - substring to search for.
      Returns:
      index where the substring has been found, or -1 else.
    • quit

      protected boolean quit()
    • acceptAndHold

      protected boolean acceptAndHold()
    • acceptLineAndDownHistory

      protected boolean acceptLineAndDownHistory()
    • acceptAndInferNextHistory

      protected boolean acceptAndInferNextHistory()
    • acceptLine

      protected boolean acceptLine()
    • selfInsert

      protected boolean selfInsert()
    • selfInsertUnmeta

      protected boolean selfInsertUnmeta()
    • overwriteMode

      protected boolean overwriteMode()
    • beginningOfBufferOrHistory

      protected boolean beginningOfBufferOrHistory()
    • beginningOfHistory

      protected boolean beginningOfHistory()
    • endOfBufferOrHistory

      protected boolean endOfBufferOrHistory()
    • endOfHistory

      protected boolean endOfHistory()
    • beginningOfLineHist

      protected boolean beginningOfLineHist()
    • endOfLineHist

      protected boolean endOfLineHist()
    • upHistory

      protected boolean upHistory()
    • downHistory

      protected boolean downHistory()
    • viUpLineOrHistory

      protected boolean viUpLineOrHistory()
    • viDownLineOrHistory

      protected boolean viDownLineOrHistory()
    • upLine

      protected boolean upLine()
    • downLine

      protected boolean downLine()
    • upLineOrHistory

      protected boolean upLineOrHistory()
    • upLineOrSearch

      protected boolean upLineOrSearch()
    • downLineOrHistory

      protected boolean downLineOrHistory()
    • downLineOrSearch

      protected boolean downLineOrSearch()
    • viCmdMode

      protected boolean viCmdMode()
    • viInsert

      protected boolean viInsert()
    • viAddNext

      protected boolean viAddNext()
    • viAddEol

      protected boolean viAddEol()
    • emacsEditingMode

      protected boolean emacsEditingMode()
    • viChangeWholeLine

      protected boolean viChangeWholeLine()
    • viChangeEol

      protected boolean viChangeEol()
    • viKillEol

      protected boolean viKillEol()
    • quotedInsert

      protected boolean quotedInsert()
    • viJoin

      protected boolean viJoin()
    • viKillWholeLine

      protected boolean viKillWholeLine()
    • viInsertBol

      protected boolean viInsertBol()
    • backwardDeleteChar

      protected boolean backwardDeleteChar()
    • viFirstNonBlank

      protected boolean viFirstNonBlank()
    • viBeginningOfLine

      protected boolean viBeginningOfLine()
    • viEndOfLine

      protected boolean viEndOfLine()
    • beginningOfLine

      protected boolean beginningOfLine()
    • endOfLine

      protected boolean endOfLine()
    • deleteChar

      protected boolean deleteChar()
    • viBackwardDeleteChar

      protected boolean viBackwardDeleteChar()
      Deletes the previous character from the cursor position
      Returns:
      true if it succeeded, false otherwise
    • viDeleteChar

      protected boolean viDeleteChar()
      Deletes the character you are sitting on and sucks the rest of the line in from the right.
      Returns:
      true if it succeeded, false otherwise
    • viSwapCase

      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.
      Returns:
      true if it succeeded, false otherwise
    • viReplaceChars

      protected boolean viReplaceChars()
      Implements the vi change character command (in move-mode "r" followed by the character to change to).
      Returns:
      true if it succeeded, false otherwise
    • viChange

      protected boolean viChange(int startPos, int endPos)
    • viDeleteTo

      protected boolean viDeleteTo(int startPos, int endPos)
    • doViDeleteOrChange

      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.
      Parameters:
      startPos - The start position
      endPos - 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 change
      Returns:
      true if it succeeded, false otherwise
    • viYankTo

      protected boolean viYankTo(int startPos, int endPos)
      Implement the "vi" yank-to operation. This operation allows you to yank the contents of the current line based upon a move operation, for example "yw" yanks the current word, "3yw" yanks 3 words, etc.
      Parameters:
      startPos - The starting position from which to yank
      endPos - The ending position to which to yank
      Returns:
      true if the yank succeeded
    • viOpenLineAbove

      protected boolean viOpenLineAbove()
    • viOpenLineBelow

      protected boolean viOpenLineBelow()
    • viPutAfter

      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.
      Returns:
      true
    • viPutBefore

      protected boolean viPutBefore()
    • doLowercaseVersion

      protected boolean doLowercaseVersion()
    • setMarkCommand

      protected boolean setMarkCommand()
    • exchangePointAndMark

      protected boolean exchangePointAndMark()
    • visualMode

      protected boolean visualMode()
    • visualLineMode

      protected boolean visualLineMode()
    • deactivateRegion

      protected boolean deactivateRegion()
    • whatCursorPosition

      protected boolean whatCursorPosition()
    • editAndExecute

      protected boolean editAndExecute()
    • builtinWidgets

      protected Map<String,Widget> builtinWidgets()
    • redisplay

      public boolean redisplay()
    • redisplay

      protected void redisplay(boolean flush)
    • getDisplayedBufferWithPrompts

      public AttributedString getDisplayedBufferWithPrompts(List<AttributedString> secondaryPrompts)
      Compute the full string to be displayed with the left, right and secondary prompts
      Parameters:
      secondaryPrompts - a list to store the secondary prompts
      Returns:
      the displayed string including the buffer, left prompts and the help below
    • insertTab

      protected boolean insertTab()
    • expandHistory

      protected boolean expandHistory()
    • expandWord

      protected boolean expandWord()
    • expandOrComplete

      protected boolean expandOrComplete()
    • expandOrCompletePrefix

      protected boolean expandOrCompletePrefix()
    • completeWord

      protected boolean completeWord()
    • completePrefix

      protected boolean completePrefix()
    • listChoices

      protected boolean listChoices()
    • deleteCharOrList

      protected boolean deleteCharOrList()
    • doComplete

      protected boolean doComplete(LineReaderImpl.CompletionType lst, boolean useMenu, boolean prefix)
    • doComplete

      protected boolean doComplete(LineReaderImpl.CompletionType lst, boolean useMenu, boolean prefix, boolean forSuggestion)
    • wrap

      protected static CompletingParsedLine wrap(ParsedLine line)
    • getCandidateComparator

      protected Comparator<Candidate> getCandidateComparator(boolean caseInsensitive, String word)
    • getOthersGroupName

      protected String getOthersGroupName()
    • getOriginalGroupName

      protected String getOriginalGroupName()
    • getGroupComparator

      protected Comparator<String> getGroupComparator()
    • nextBindingIsComplete

      protected boolean nextBindingIsComplete()
    • doMenu

      protected boolean doMenu(List<Candidate> original, String completed, BiFunction<CharSequence,Boolean,CharSequence> escaper)
    • clearChoices

      protected boolean clearChoices()
    • doList

      protected boolean doList(List<Candidate> possible, String completed, boolean runLoop, BiFunction<CharSequence,Boolean,CharSequence> escaper)
    • doList

      protected boolean doList(List<Candidate> possible, String completed, boolean runLoop, BiFunction<CharSequence,Boolean,CharSequence> escaper, boolean forSuggestion)
    • computePost

      protected LineReaderImpl.PostResult computePost(List<Candidate> possible, Candidate selection, List<Candidate> ordered, String completed)
    • computePost

      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)
    • toColumns

      protected LineReaderImpl.PostResult toColumns(List<Object> items, Candidate selection, String completed, Function<String,Integer> wcwidth, int width, boolean rowsFirst)
    • toColumns

      protected void toColumns(Object items, int width, int maxWidth, AttributedStringBuilder sb, Candidate selection, String completed, boolean rowsFirst, boolean doMenuList, int[] out)
    • getCompletionStyleStarting

      protected AttributedStyle getCompletionStyleStarting(boolean menuList)
    • getCompletionStyleDescription

      protected AttributedStyle getCompletionStyleDescription(boolean menuList)
    • getCompletionStyleGroup

      protected AttributedStyle getCompletionStyleGroup(boolean menuList)
    • getCompletionStyleSelection

      protected AttributedStyle getCompletionStyleSelection(boolean menuList)
    • getCompletionStyleBackground

      protected AttributedStyle getCompletionStyleBackground(boolean menuList)
    • getCompletionStyleStarting

      protected AttributedStyle getCompletionStyleStarting()
    • getCompletionStyleDescription

      protected AttributedStyle getCompletionStyleDescription()
    • getCompletionStyleGroup

      protected AttributedStyle getCompletionStyleGroup()
    • getCompletionStyleSelection

      protected AttributedStyle getCompletionStyleSelection()
    • getCompletionStyleBackground

      protected AttributedStyle getCompletionStyleBackground()
    • getCompletionStyleListStarting

      protected AttributedStyle getCompletionStyleListStarting()
    • getCompletionStyleListDescription

      protected AttributedStyle getCompletionStyleListDescription()
    • getCompletionStyleListGroup

      protected AttributedStyle getCompletionStyleListGroup()
    • getCompletionStyleListSelection

      protected AttributedStyle getCompletionStyleListSelection()
    • getCompletionStyleListBackground

      protected AttributedStyle getCompletionStyleListBackground()
    • getCompletionStyle

      protected AttributedStyle getCompletionStyle(String name, String value)
    • buildStyle

      protected AttributedStyle buildStyle(String str)
    • moveHistory

      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.
      Parameters:
      next - If true, move forward
      count - The number of entries to move
      Returns:
      true if the move was successful
    • moveHistory

      protected boolean moveHistory(boolean next)
      Move up or down the history tree.
      Parameters:
      next - true to go to the next, false for the previous.
      Returns:
      true if successful, false otherwise
    • killBuffer

      protected boolean killBuffer()
    • killWholeLine

      protected boolean killWholeLine()
    • killLine

      public boolean killLine()
      Kill the buffer ahead of the current cursor position.
      Returns:
      true if successful
    • backwardKillLine

      public boolean backwardKillLine()
    • killRegion

      public boolean killRegion()
    • copyRegionAsKill

      public boolean copyRegionAsKill()
    • yank

      public boolean yank()
    • yankPop

      public boolean yankPop()
    • mouse

      public boolean mouse()
    • beginPaste

      public boolean beginPaste()
    • focusIn

      public boolean focusIn()
    • focusOut

      public boolean focusOut()
    • clear

      public boolean clear()
      Clean the used display
      Returns:
      true
    • clearScreen

      public boolean clearScreen()
      Clear the screen by issuing the ANSI "clear screen" code.
      Returns:
      true
    • beep

      public boolean beep()
      Issue an audible keyboard bell.
      Returns:
      true
    • isDelimiter

      protected boolean isDelimiter(int c)
      Checks to see if the specified character is a delimiter. We consider a character a delimiter if it is anything but a letter or digit.
      Parameters:
      c - The character to test
      Returns:
      True if it is a delimiter
    • isWhitespace

      protected boolean isWhitespace(int c)
      Checks to see if a character is a whitespace character. Currently this delegates to Character.isWhitespace(char), however eventually it should be hooked up so that the definition of whitespace can be configured, as readline does.
      Parameters:
      c - The character to check
      Returns:
      true if the character is a whitespace
    • isViAlphaNum

      protected boolean isViAlphaNum(int c)
    • isAlpha

      protected boolean isAlpha(int c)
    • isWord

      protected boolean isWord(int c)
    • defaultKeyMaps

      public Map<String,KeyMap<Binding>> defaultKeyMaps()
      Specified by:
      defaultKeyMaps in interface LineReader
    • emacs

      public KeyMap<Binding> emacs()
    • viInsertion

      public KeyMap<Binding> viInsertion()
    • viCmd

      public KeyMap<Binding> viCmd()
    • safe

      public KeyMap<Binding> safe()
    • dumb

      public KeyMap<Binding> dumb()
    • visual

      public KeyMap<Binding> visual()
    • viOpp

      public KeyMap<Binding> viOpp()
    • zeroOut

      public void zeroOut()
      Description copied from interface: LineReader
      Clear any internal buffers.
      Specified by:
      zeroOut in interface LineReader