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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDescription
(List<AttributedString> desc) Add description text to the terminal status barvoid
Add widget to the LineReadervoid
aliasWidget
(String orig, String alias) Create alias to widgetargs()
Parse lineReader buffer and returns its argumentsbuffer()
Get lineReader's buffervoid
callWidget
(String name) Call widget.void
Clears terminal status barvoid
Clears command line command hintcurrChar()
Access lineReader's buffer and return its current charactervoid
Remove terminal status barvoid
executeWidget
(String name) Bind widget to ctrl-alt-x and execute itboolean
existsWidget
(String name) Test if widget existsGet lineReader's Main KeyMapResolve widget name if its alias is given as method parameter.void
initDescription
(int size) Initialize terminal status barGet lineReader's last bindingprivate Widget
namedWidget
(String name, Widget widget) parser()
Get lineReader's parserprevChar()
Access lineReader buffer and return its previous charactervoid
Write the string parameter to the lineReader's buffervoid
replaceBuffer
(Buffer buffer) Replace lineReader buffervoid
setErrorIndex
(int errorIndex) Set errorIndex to the lineReader's highlightervoid
setErrorPattern
(Pattern errorPattern) Set errorPattern to the lineReader's highlightervoid
Set lineReader's autosuggestion typevoid
setTailTip
(String tailTip) Set lineReader's command hint to be added in the command linetailTip()
Get lineReader's command hintprivate Widget
-
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
-
-
Constructor Details
-
Widgets
-
-
Method Details
-
addWidget
Add widget to the LineReader- Parameters:
name
- the name of widgetwidget
- widget
-
namedWidget
-
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
-
widget
-
parser
Get lineReader's parser- Returns:
- The parser
-
getKeyMap
Get lineReader's Main KeyMap- Returns:
- The KeyMap
-
buffer
Get lineReader's buffer- Returns:
- The buffer
-
replaceBuffer
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
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
-