Package org.jline.widget
Class Widgets
java.lang.Object
org.jline.widget.Widgets
- Direct Known Subclasses:
AutopairWidgets,AutosuggestionWidgets,TailTipWidgets
Create custom widgets by extending Widgets class
- Author:
- Matti Rinta-Nikkola
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDescription(List<org.jline.utils.AttributedString> desc) voidAdd widget to the LineReadervoidaliasWidget(String orig, String alias) Create alias to widgetargs()org.jline.reader.Bufferbuffer()voidcallWidget(String name) Call widget.voidClears terminal status barvoidClears command line tail tipcurrChar()voidRemove terminal status barvoidexecuteWidget(String name) Bind widget to ctrl-alt-x and execute itbooleanexistsWidget(String name) org.jline.keymap.KeyMap<org.jline.reader.Binding>voidinitDescription(int size) Initialize terminal status barorg.jline.reader.Parserparser()prevChar()voidvoidreplaceBuffer(org.jline.reader.Buffer buffer) voidsetErrorIndex(int errorIndex) voidsetErrorPattern(Pattern errorPattern) voidsetSuggestionType(org.jline.reader.LineReader.SuggestionType type) voidsetTailTip(String tailTip) tailTip()
-
Field Details
-
TAILTIP_TOGGLE
- See Also:
-
TAILTIP_PANE
- See Also:
-
AUTOPAIR_TOGGLE
- See Also:
-
AUTOSUGGEST_TOGGLE
- See Also:
-
AP_INSERT
- See Also:
-
AP_BACKWARD_DELETE_CHAR
- See Also:
-
TT_ACCEPT_LINE
- See Also:
-
reader
protected final org.jline.reader.LineReader reader
-
-
Constructor Details
-
Widgets
public Widgets(org.jline.reader.LineReader reader)
-
-
Method Details
-
addWidget
Add widget to the LineReader- Parameters:
name- the name of widgetwidget- widget
-
callWidget
Call widget. System widget will be call if the name does not start with '_' or ends with '-toggle' i.e. '.' will be added at the beginning of the name.- Parameters:
name- widget name
-
executeWidget
Bind widget to ctrl-alt-x and execute it- Parameters:
name- widget name
-
aliasWidget
Create alias to widget- Parameters:
orig- widget original namealias- alias name
-
getWidget
- Parameters:
name- widget name or alias- Returns:
- widget name
-
existsWidget
- Parameters:
name- widget name or alias- Returns:
- true if widget exists
-
parser
public org.jline.reader.Parser parser()- Returns:
- The LineRearer Parser
-
getKeyMap
public org.jline.keymap.KeyMap<org.jline.reader.Binding> getKeyMap()- Returns:
- The LineReader Main KeyMap
-
buffer
public org.jline.reader.Buffer buffer()- Returns:
- The LineReader Buffer
-
replaceBuffer
public void replaceBuffer(org.jline.reader.Buffer buffer) - Parameters:
buffer- buffer that will be copied to the LineReader Buffer
-
args
- Returns:
- command line arguments
-
prevChar
- Returns:
- Buffer's previous character
-
currChar
- Returns:
- Buffer's current character
-
lastBinding
- Returns:
- LineReader's last binding
-
putString
- Parameters:
string- string to be written into LineReader Buffer
-
tailTip
- Returns:
- Command line tail tip.
-
setTailTip
- Parameters:
tailTip- tail tip to be added to the command line
-
setErrorPattern
- Parameters:
errorPattern- error pattern to be set LineReader Highlighter
-
setErrorIndex
public void setErrorIndex(int errorIndex) - Parameters:
errorIndex- error index to be set LineReader Highlighter
-
clearTailTip
public void clearTailTip()Clears command line tail tip -
setSuggestionType
public void setSuggestionType(org.jline.reader.LineReader.SuggestionType type) - Parameters:
type- type to be set to the LineReader autosuggestion
-
addDescription
- Parameters:
desc- Text to be displayed on terminal status bar
-
clearDescription
public void clearDescription()Clears terminal status bar -
initDescription
public void initDescription(int size) Initialize terminal status bar- Parameters:
size- Terminal status bar size in rows
-
destroyDescription
public void destroyDescription()Remove terminal status bar
-