Package org.jline.reader
Interface LineReader
- All Known Implementing Classes:
LineReaderImpl
public interface LineReader
Read lines from the console, with input editing.
Thread safety
TheLineReader implementations are not thread safe,
thus you should not attempt to use a single reader in several threads.
Any attempt to call one of the readLine call while one is
already executing in a different thread will immediately result in an
IllegalStateException being thrown. Other calls may lead to
unknown behaviors. There is one exception though: users are allowed to call
printAbove(String) or printAbove(AttributedString) at
any time to allow text to be printed above the current prompt.
Prompt strings
It is traditional for an interactive console-based program to print a short prompt string to signal that the user is expected to type a command. JLine supports 3 kinds of prompt string:- The normal prompt at the start (left) of the initial line of a command.
- An optional right prompt at the right border of the initial line.
- A start (left) prompt for continuation lines. I.e. the lines after the first line of a multi-line command.
All of these are specified with prompt templates,
which are similar to printf format strings,
using the character '%' to indicate special functionality.
%N- A line number. This is the sum of
getLineNumber()and a counter starting with 1 for the first continuation line. %M- A short word explaining what is "missing". This is supplied from
the
EOFError.getMissing()method, if provided. Defaults to an empty string. %nPc- Insert padding at this position, repeating the following character c as needed to bring the total prompt column width as specified by the digits n.
%Pc- As before, but use width from the initial prompt.
%%- A literal
'%'. %{%}- Text between a
%{...%}pair is printed as part of a prompt, but not interpreted by JLine (except that'%'-escapes are processed). The text is assumed to take zero columns (not move the cursor). If it changes the style, you're responsible for changing it back. Standard ANSI escape sequences do not need to be within a%{...%}pair (though can be) since JLine knows how to deal with them. However, these delimiters are needed for unusual non-standard escape sequences.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringTimeout for ambiguous key sequences.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringCompletion style for displaying the liststatic final StringCompletion style for displaying the candidate descriptionstatic final StringCompletion style for displaying groups namestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringCompletion style for displaying the current selected itemstatic final StringCompletion style for displaying the matching part of candidatesstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringNumber of matching errors that are accepted by the completion matcherstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringMax buffer size for advanced features.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFile system history path.static final StringNumber of history items to keep in the history file.static final StringColon separated list of patterns that will not be saved in history.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringNumber of history items to keep in memory.static final StringNew line automatic indentation after opening/closing bracket.static final Stringstatic final StringName of inputrc to read at line reader creation time.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringWhen in multiline edit mode, this variable can be used to offset the line number displayed.static final Stringstatic final Stringstatic final Stringtab completion: if candidates are more than list-max a question will be asked before displaying themstatic final Stringstatic final Stringstatic final StringMax number of times a command can be repeated.static final Stringstatic final Stringstatic final Stringstatic final Stringtab completion: if candidates are less than menu-list-max they are displayed in a list below the field to be completedstatic final Stringstatic final Stringstatic final Stringstatic final StringProperty for the "original" group namestatic final StringProperty for the "others" group namestatic final Stringstatic final Stringstatic final StringSystem property that can be set to avoid a warning being logged when using a Parser which does not returnCompletingParsedLineobjects.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringSet the template for prompts for secondary (continuation) lines.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringMin buffer size for tab auto-suggestions.static final StringPrefix to automatically delegate variables to system propertiesstatic final StringNumber of spaces to display a tabulation, the default is 4.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommandsInBuffer(Collection<String> commands) voidcallWidget(String name) default voideditAndAddInBuffer(File file) voideditAndAddInBuffer(Path file) getKeys()intgetVariable(String name) booleanCheck if a thread is currently in areadLine()call.booleanisSet(LineReader.Option option) option(LineReader.Option option, boolean value) voidprintAbove(String str) Prints a line above the prompt and redraw everything.voidPrints a string before the prompt and redraw everything.readLine()Read the next line and return the contents of the buffer.Read the next line with the specified character mask.Read the next line with the specified prompt.Read a line from the inInputStream, and return the line (without any trailing newlines).Read a line from the inInputStream, and return the line (without any trailing newlines).Read a line from the inInputStream, and return the line (without any trailing newlines).readLine(String prompt, String rightPrompt, MaskingCallback maskingCallback, String buffer) Read a line from the inInputStream, and return the line (without any trailing newlines).Read a mouse event when theInfoCmp.Capability.key_mousesequence has just been read on the input stream.voidPush back a key sequence that will be later consumed by the line reader.voidbooleanvoidsetOpt(LineReader.Option option) voidsetTailTip(String tailTip) voidsetVariable(String name, Object value) voidunsetOpt(LineReader.Option option) voidzeroOut()Clear any internal buffers.
-
Field Details
-
PROP_SUPPORT_PARSEDLINE
System property that can be set to avoid a warning being logged when using a Parser which does not returnCompletingParsedLineobjects.- See Also:
-
CALLBACK_INIT
- See Also:
-
CALLBACK_FINISH
- See Also:
-
CALLBACK_KEYMAP
- See Also:
-
ACCEPT_AND_INFER_NEXT_HISTORY
- See Also:
-
ACCEPT_AND_HOLD
- See Also:
-
ACCEPT_LINE
- See Also:
-
ACCEPT_LINE_AND_DOWN_HISTORY
- See Also:
-
ARGUMENT_BASE
- See Also:
-
BACKWARD_CHAR
- See Also:
-
BACKWARD_DELETE_CHAR
- See Also:
-
BACKWARD_DELETE_WORD
- See Also:
-
BACKWARD_KILL_LINE
- See Also:
-
BACKWARD_KILL_WORD
- See Also:
-
BACKWARD_WORD
- See Also:
-
BEEP
- See Also:
-
BEGINNING_OF_BUFFER_OR_HISTORY
- See Also:
-
BEGINNING_OF_HISTORY
- See Also:
-
BEGINNING_OF_LINE
- See Also:
-
BEGINNING_OF_LINE_HIST
- See Also:
-
CAPITALIZE_WORD
- See Also:
-
CHARACTER_SEARCH
- See Also:
-
CHARACTER_SEARCH_BACKWARD
- See Also:
-
CLEAR
- See Also:
-
CLEAR_SCREEN
- See Also:
-
COMPLETE_PREFIX
- See Also:
-
COMPLETE_WORD
- See Also:
-
COPY_PREV_WORD
- See Also:
-
COPY_REGION_AS_KILL
- See Also:
-
DELETE_CHAR
- See Also:
-
DELETE_CHAR_OR_LIST
- See Also:
-
DELETE_WORD
- See Also:
-
DIGIT_ARGUMENT
- See Also:
-
DO_LOWERCASE_VERSION
- See Also:
-
DOWN_CASE_WORD
- See Also:
-
DOWN_HISTORY
- See Also:
-
DOWN_LINE
- See Also:
-
DOWN_LINE_OR_HISTORY
- See Also:
-
DOWN_LINE_OR_SEARCH
- See Also:
-
EDIT_AND_EXECUTE_COMMAND
- See Also:
-
EMACS_BACKWARD_WORD
- See Also:
-
EMACS_EDITING_MODE
- See Also:
-
EMACS_FORWARD_WORD
- See Also:
-
END_OF_BUFFER_OR_HISTORY
- See Also:
-
END_OF_HISTORY
- See Also:
-
END_OF_LINE
- See Also:
-
END_OF_LINE_HIST
- See Also:
-
EXCHANGE_POINT_AND_MARK
- See Also:
-
EXECUTE_NAMED_CMD
- See Also:
-
EXPAND_HISTORY
- See Also:
-
EXPAND_OR_COMPLETE
- See Also:
-
EXPAND_OR_COMPLETE_PREFIX
- See Also:
-
EXPAND_WORD
- See Also:
-
FRESH_LINE
- See Also:
-
FORWARD_CHAR
- See Also:
-
FORWARD_WORD
- See Also:
-
HISTORY_BEGINNING_SEARCH_BACKWARD
- See Also:
-
HISTORY_BEGINNING_SEARCH_FORWARD
- See Also:
-
HISTORY_INCREMENTAL_PATTERN_SEARCH_BACKWARD
- See Also:
-
HISTORY_INCREMENTAL_PATTERN_SEARCH_FORWARD
- See Also:
-
HISTORY_INCREMENTAL_SEARCH_BACKWARD
- See Also:
-
HISTORY_INCREMENTAL_SEARCH_FORWARD
- See Also:
-
HISTORY_SEARCH_BACKWARD
- See Also:
-
HISTORY_SEARCH_FORWARD
- See Also:
-
INSERT_CLOSE_CURLY
- See Also:
-
INSERT_CLOSE_PAREN
- See Also:
-
INSERT_CLOSE_SQUARE
- See Also:
-
INFER_NEXT_HISTORY
- See Also:
-
INSERT_COMMENT
- See Also:
-
INSERT_LAST_WORD
- See Also:
-
KILL_BUFFER
- See Also:
-
KILL_LINE
- See Also:
-
KILL_REGION
- See Also:
-
KILL_WHOLE_LINE
- See Also:
-
KILL_WORD
- See Also:
-
LIST_CHOICES
- See Also:
-
LIST_EXPAND
- See Also:
-
MAGIC_SPACE
- See Also:
-
MENU_EXPAND_OR_COMPLETE
- See Also:
-
MENU_COMPLETE
- See Also:
-
MENU_SELECT
- See Also:
-
NEG_ARGUMENT
- See Also:
-
OVERWRITE_MODE
- See Also:
-
PUT_REPLACE_SELECTION
- See Also:
-
QUOTED_INSERT
- See Also:
-
READ_COMMAND
- See Also:
-
RECURSIVE_EDIT
- See Also:
-
REDISPLAY
- See Also:
-
REDRAW_LINE
- See Also:
-
REDO
- See Also:
-
REVERSE_MENU_COMPLETE
- See Also:
-
SELF_INSERT
- See Also:
-
SELF_INSERT_UNMETA
- See Also:
-
SEND_BREAK
- See Also:
-
SET_LOCAL_HISTORY
- See Also:
-
SET_MARK_COMMAND
- See Also:
-
SPELL_WORD
- See Also:
-
SPLIT_UNDO
- See Also:
-
TRANSPOSE_CHARS
- See Also:
-
TRANSPOSE_WORDS
- See Also:
-
UNDEFINED_KEY
- See Also:
-
UNDO
- See Also:
-
UNIVERSAL_ARGUMENT
- See Also:
-
UP_CASE_WORD
- See Also:
-
UP_HISTORY
- See Also:
-
UP_LINE
- See Also:
-
UP_LINE_OR_HISTORY
- See Also:
-
UP_LINE_OR_SEARCH
- See Also:
-
VI_ADD_EOL
- See Also:
-
VI_ADD_NEXT
- See Also:
-
VI_BACKWARD_BLANK_WORD
- See Also:
-
VI_BACKWARD_BLANK_WORD_END
- See Also:
-
VI_BACKWARD_CHAR
- See Also:
-
VI_BACKWARD_DELETE_CHAR
- See Also:
-
VI_BACKWARD_KILL_WORD
- See Also:
-
VI_BACKWARD_WORD
- See Also:
-
VI_BACKWARD_WORD_END
- See Also:
-
VI_BEGINNING_OF_LINE
- See Also:
-
VI_CHANGE
- See Also:
-
VI_CHANGE_EOL
- See Also:
-
VI_CHANGE_WHOLE_LINE
- See Also:
-
VI_CMD_MODE
- See Also:
-
VI_DELETE
- See Also:
-
VI_DELETE_CHAR
- See Also:
-
VI_DIGIT_OR_BEGINNING_OF_LINE
- See Also:
-
VI_DOWN_LINE_OR_HISTORY
- See Also:
-
VI_END_OF_LINE
- See Also:
-
VI_FETCH_HISTORY
- See Also:
-
VI_FIND_NEXT_CHAR
- See Also:
-
VI_FIND_NEXT_CHAR_SKIP
- See Also:
-
VI_FIND_PREV_CHAR
- See Also:
-
VI_FIND_PREV_CHAR_SKIP
- See Also:
-
VI_FIRST_NON_BLANK
- See Also:
-
VI_FORWARD_BLANK_WORD
- See Also:
-
VI_FORWARD_BLANK_WORD_END
- See Also:
-
VI_FORWARD_CHAR
- See Also:
-
VI_FORWARD_WORD
- See Also:
-
VI_FORWARD_WORD_END
- See Also:
-
VI_GOTO_COLUMN
- See Also:
-
VI_HISTORY_SEARCH_BACKWARD
- See Also:
-
VI_HISTORY_SEARCH_FORWARD
- See Also:
-
VI_INSERT
- See Also:
-
VI_INSERT_BOL
- See Also:
-
VI_INSERT_COMMENT
- See Also:
-
VI_JOIN
- See Also:
-
VI_KILL_EOL
- See Also:
-
VI_KILL_LINE
- See Also:
-
VI_MATCH_BRACKET
- See Also:
-
VI_OPEN_LINE_ABOVE
- See Also:
-
VI_OPEN_LINE_BELOW
- See Also:
-
VI_OPER_SWAP_CASE
- See Also:
-
VI_PUT_AFTER
- See Also:
-
VI_PUT_BEFORE
- See Also:
-
VI_QUOTED_INSERT
- See Also:
-
VI_REPEAT_CHANGE
- See Also:
-
VI_REPEAT_FIND
- See Also:
-
VI_REPEAT_SEARCH
- See Also:
-
VI_REPLACE
- See Also:
-
VI_REPLACE_CHARS
- See Also:
-
VI_REV_REPEAT_FIND
- See Also:
-
VI_REV_REPEAT_SEARCH
- See Also:
-
VI_SET_BUFFER
- See Also:
-
VI_SUBSTITUTE
- See Also:
-
VI_SWAP_CASE
- See Also:
-
VI_UNDO_CHANGE
- See Also:
-
VI_UP_LINE_OR_HISTORY
- See Also:
-
VI_YANK
- See Also:
-
VI_YANK_EOL
- See Also:
-
VI_YANK_WHOLE_LINE
- See Also:
-
VISUAL_LINE_MODE
- See Also:
-
VISUAL_MODE
- See Also:
-
WHAT_CURSOR_POSITION
- See Also:
-
YANK
- See Also:
-
YANK_POP
- See Also:
-
MOUSE
- See Also:
-
FOCUS_IN
- See Also:
-
FOCUS_OUT
- See Also:
-
BEGIN_PASTE
- See Also:
-
VICMD
- See Also:
-
VIINS
- See Also:
-
VIOPP
- See Also:
-
VISUAL
- See Also:
-
MAIN
- See Also:
-
EMACS
- See Also:
-
SAFE
- See Also:
-
DUMB
- See Also:
-
MENU
- See Also:
-
BIND_TTY_SPECIAL_CHARS
- See Also:
-
COMMENT_BEGIN
- See Also:
-
BELL_STYLE
- See Also:
-
PREFER_VISIBLE_BELL
- See Also:
-
LIST_MAX
tab completion: if candidates are more than list-max a question will be asked before displaying them- See Also:
-
MENU_LIST_MAX
tab completion: if candidates are less than menu-list-max they are displayed in a list below the field to be completed- See Also:
-
DISABLE_HISTORY
- See Also:
-
DISABLE_COMPLETION
- See Also:
-
EDITING_MODE
- See Also:
-
KEYMAP
- See Also:
-
BLINK_MATCHING_PAREN
- See Also:
-
WORDCHARS
- See Also:
-
REMOVE_SUFFIX_CHARS
- See Also:
-
SEARCH_TERMINATORS
- See Also:
-
ERRORS
Number of matching errors that are accepted by the completion matcher- See Also:
-
OTHERS_GROUP_NAME
-
ORIGINAL_GROUP_NAME
-
COMPLETION_STYLE_GROUP
-
COMPLETION_STYLE_LIST_GROUP
- See Also:
-
COMPLETION_STYLE_SELECTION
Completion style for displaying the current selected item- See Also:
-
COMPLETION_STYLE_LIST_SELECTION
- See Also:
-
COMPLETION_STYLE_DESCRIPTION
Completion style for displaying the candidate description- See Also:
-
COMPLETION_STYLE_LIST_DESCRIPTION
- See Also:
-
COMPLETION_STYLE_STARTING
Completion style for displaying the matching part of candidates- See Also:
-
COMPLETION_STYLE_LIST_STARTING
- See Also:
-
COMPLETION_STYLE_BACKGROUND
-
COMPLETION_STYLE_LIST_BACKGROUND
- See Also:
-
SECONDARY_PROMPT_PATTERN
Set the template for prompts for secondary (continuation) lines. This is a prompt template as described in the class header.- See Also:
-
LINE_OFFSET
When in multiline edit mode, this variable can be used to offset the line number displayed.- See Also:
-
AMBIGUOUS_BINDING
Timeout for ambiguous key sequences. If the key sequence is ambiguous, i.e. there is a matching sequence but the sequence is also a prefix for other bindings, the next key press will be waited for a specified amount of time. If the timeout elapses, the matched sequence will be used.- See Also:
-
HISTORY_IGNORE
Colon separated list of patterns that will not be saved in history.- See Also:
-
HISTORY_FILE
-
HISTORY_SIZE
-
HISTORY_FILE_SIZE
Number of history items to keep in the history file.- See Also:
-
INDENTATION
New line automatic indentation after opening/closing bracket.- See Also:
-
FEATURES_MAX_BUFFER_SIZE
Max buffer size for advanced features. Once the length of the buffer reaches this threshold, no advanced features will be enabled. This includes the undo buffer, syntax highlighting, parsing, etc....- See Also:
-
SUGGESTIONS_MIN_BUFFER_SIZE
Min buffer size for tab auto-suggestions. For shorter buffer sizes auto-suggestions are not resolved.- See Also:
-
MAX_REPEAT_COUNT
-
TAB_WIDTH
-
INPUT_RC_FILE_NAME
Name of inputrc to read at line reader creation time.- See Also:
-
SYSTEM_PROPERTY_PREFIX
Prefix to automatically delegate variables to system properties- See Also:
-
-
Method Details
-
defaultKeyMaps
-
readLine
Read the next line and return the contents of the buffer. Equivalent toreadLine(null, null, null).- Returns:
- the line read
- Throws:
UserInterruptException- if readLine was interrupted (using Ctrl-C for example)EndOfFileException- if an EOF has been found (using Ctrl-D for example)IOError- in case of other i/o errors
-
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. Equivalent toreadLine(null, mask, null)- Parameters:
mask- The mask character,nullor0.- 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)IOError- in case of other i/o errors
-
readLine
Read the next line with the specified prompt. If null, then the default prompt will be used. Equivalent toreadLine(prompt, null, null)- 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)IOError- in case of other i/o errors
-
readLine
Read a line from the inInputStream, and return the line (without any trailing newlines). Equivalent toreadLine(prompt, mask, null)- Parameters:
prompt- The prompt to issue to the terminal, may be null.mask- The mask character,nullor0.- 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)IOError- in case of other i/o errors
-
readLine
String readLine(String prompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException Read a line from the inInputStream, and return the line (without any trailing newlines). Equivalent toreadLine(prompt, null, mask, buffer)- Parameters:
prompt- The prompt to issue to the terminal, may be null. 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.- 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)IOError- in case of other i/o errors
-
readLine
String readLine(String prompt, String rightPrompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException Read a line from the inInputStream, and return the line (without any trailing newlines).- Parameters:
prompt- The prompt to issue to the terminal, may be null. This is a template, with optional'%'escapes, as described in the class header.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.- 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)IOError- in case of other i/o errors
-
readLine
String readLine(String prompt, String rightPrompt, MaskingCallback maskingCallback, String buffer) throws UserInterruptException, EndOfFileException Read a line from the inInputStream, and return the line (without any trailing newlines).- Parameters:
prompt- The prompt to issue to the terminal, may be null. This is a template, with optional'%'escapes, as described in the class header.rightPrompt- The right prompt This is a template, with optional'%'escapes, as described in the class header.maskingCallback- TheMaskingCallbackto use when displaying lines and adding them to the lineHistorybuffer- The default value presented to the user to edit, 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)IOError- in case of other i/o errors
-
printAbove
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.- Parameters:
str- the string to print- See Also:
-
printAbove
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.- Parameters:
str- the string to print- See Also:
-
isReading
boolean isReading()Check if a thread is currently in areadLine()call.- Returns:
trueif there is an ongoingreadLine()call.
-
variable
-
option
-
callWidget
-
getVariables
-
getVariable
-
setVariable
-
isSet
-
setOpt
-
unsetOpt
-
getTerminal
Terminal getTerminal() -
getWidgets
-
getBuiltinWidgets
-
getBuffer
Buffer getBuffer() -
getAppName
String getAppName() -
runMacro
Push back a key sequence that will be later consumed by the line reader. This method can be used after reading the cursor position usingTerminal.getCursorPosition(IntConsumer).- Parameters:
macro- the key sequence to push back- See Also:
-
readMouseEvent
MouseEvent readMouseEvent()Read a mouse event when theInfoCmp.Capability.key_mousesequence has just been read on the input stream. Compared toTerminal.readMouseEvent(), this method takes into account keys that have been pushed back usingrunMacro(String).- Returns:
- the mouse event
- See Also:
-
getHistory
History getHistory() -
getParser
Parser getParser() -
getHighlighter
Highlighter getHighlighter() -
getExpander
Expander getExpander() -
getKeyMaps
-
getKeyMap
String getKeyMap() -
setKeyMap
-
getKeys
-
getParsedLine
ParsedLine getParsedLine() -
getSearchTerm
String getSearchTerm() -
getRegionActive
LineReader.RegionType getRegionActive() -
getRegionMark
int getRegionMark() -
addCommandsInBuffer
-
editAndAddInBuffer
-
editAndAddInBuffer
-
getLastBinding
String getLastBinding() -
getTailTip
String getTailTip() -
setTailTip
-
setAutosuggestion
-
getAutosuggestion
LineReader.SuggestionType getAutosuggestion() -
zeroOut
void zeroOut()Clear any internal buffers.
-