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) Add description text to the terminal status barvoidAdd widget to the LineReadervoidaliasWidget(String orig, String alias) Create alias to widgetargs()Parse lineReader buffer and returns its argumentsorg.jline.reader.Bufferbuffer()Get lineReader's buffervoidcallWidget(String name) Call widget.voidClears terminal status barvoidClears command line command hintcurrChar()Access lineReader's buffer and return its current charactervoidRemove terminal status barvoidexecuteWidget(String name) Bind widget to ctrl-alt-x and execute itbooleanexistsWidget(String name) Test if widget existsorg.jline.keymap.KeyMap<org.jline.reader.Binding> Get lineReader's Main KeyMapResolve widget name if its alias is given as method parameter.voidinitDescription(int size) Initialize terminal status barGet lineReader's last bindingorg.jline.reader.Parserparser()Get lineReader's parserprevChar()Access lineReader buffer and return its previous charactervoidWrite the string parameter to the lineReader's buffervoidreplaceBuffer(org.jline.reader.Buffer buffer) Replace lineReader buffervoidsetErrorIndex(int errorIndex) Set errorIndex to the lineReader's highlightervoidsetErrorPattern(Pattern errorPattern) Set errorPattern to the lineReader's highlightervoidsetSuggestionType(org.jline.reader.LineReader.SuggestionType type) Set lineReader's autosuggestion typevoidsetTailTip(String tailTip) Set lineReader's command hint to be added in the command linetailTip()Get lineReader's command hint
-
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
Resolve widget name if its alias is given as method parameter. i.e. both method calls getWidget("yank") and getWidget(".yank") will return string ".yank"- Parameters:
name- widget name or alias- Returns:
- widget name
-
existsWidget
Test if widget exists- Parameters:
name- widget name or its alias- Returns:
- true if widget exists
-
parser
public org.jline.reader.Parser parser()Get lineReader's parser- Returns:
- The parser
-
getKeyMap
public org.jline.keymap.KeyMap<org.jline.reader.Binding> getKeyMap()Get lineReader's Main KeyMap- Returns:
- The KeyMap
-
buffer
public org.jline.reader.Buffer buffer()Get lineReader's buffer- Returns:
- The buffer
-
replaceBuffer
public void replaceBuffer(org.jline.reader.Buffer buffer) Replace lineReader buffer- Parameters:
buffer- buffer that will be copied to the LineReader Buffer
-
args
Parse lineReader buffer and returns its arguments- Returns:
- command line arguments
-
prevChar
Access lineReader buffer and return its previous character- Returns:
- previous character
-
currChar
Access lineReader's buffer and return its current character- Returns:
- current character
-
lastBinding
Get lineReader's last binding- Returns:
- last binding
-
putString
Write the string parameter to the lineReader's buffer- Parameters:
string- string to be written
-
tailTip
Get lineReader's command hint- Returns:
- Command hint.
-
setTailTip
Set lineReader's command hint to be added in the command line- Parameters:
tailTip- command hint
-
setErrorPattern
Set errorPattern to the lineReader's highlighter- Parameters:
errorPattern- error pattern
-
setErrorIndex
public void setErrorIndex(int errorIndex) Set errorIndex to the lineReader's highlighter- Parameters:
errorIndex- error index
-
clearTailTip
public void clearTailTip()Clears command line command hint -
setSuggestionType
public void setSuggestionType(org.jline.reader.LineReader.SuggestionType type) Set lineReader's autosuggestion type- Parameters:
type- autosuggestion type
-
addDescription
Add description text to the terminal status bar- Parameters:
desc- description text
-
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
-