Package org.aesh.readline.editing
Interface EditMode
public interface EditMode
Defines the interface for line editing modes such as Emacs and Vi.
- Author:
- Ståle W. Pedersen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumEditing mode types.static enumEditing status values. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an action mapping by key input and action name.Add an action mapping for a key.voidaddVariable(Variable variable, String value) Add a variable with its value.default KeyActioncreateKeyEvent(int[] input) Create a key event from input code points.booleanCheck if currently in a chained action sequence.keys()Get the key actions for this mode.mode()Get the editing mode type.Parse a key event and return the corresponding action.prevKey()Get the previous key action.voidremapKeysFromDevice(Device device) Remap keys based on device capabilities.voidsetPrevKey(KeyAction event) Set the previous key action.voidsetStatus(EditMode.Status status) Set the edit status.status()Get the current edit status.voidupdateIgnoreEOF(int eof) Update the ignore-EOF counter.variableValue(Variable variable) Get the value of a variable.
-
Method Details
-
mode
EditMode.Mode mode()Get the editing mode type.- Returns:
- the mode (EMACS or VI)
-
keys
KeyAction[] keys()Get the key actions for this mode.- Returns:
- the key actions array
-
status
EditMode.Status status()Get the current edit status.- Returns:
- the current status
-
setStatus
Set the edit status.- Parameters:
status- the new status
-
parse
Parse a key event and return the corresponding action.- Parameters:
event- the key event to parse- Returns:
- the action for this key event, or null if none
-
isInChainedAction
boolean isInChainedAction()Check if currently in a chained action sequence.- Returns:
- true if in a chained action
-
updateIgnoreEOF
void updateIgnoreEOF(int eof) Update the ignore-EOF counter.- Parameters:
eof- the EOF value to update
-
addVariable
Add a variable with its value.- Parameters:
variable- the variable to setvalue- the value to assign
-
variableValue
Get the value of a variable.- Parameters:
variable- the variable to look up- Returns:
- the variable's value, or null if not set
-
addAction
Add an action mapping for a key.- Parameters:
key- the key to mapaction- the action to perform- Returns:
- this edit mode for chaining
-
addAction
Add an action mapping by key input and action name.- Parameters:
input- the key input code pointsaction- the action name
-
remapKeysFromDevice
Remap keys based on device capabilities.- Parameters:
device- the terminal device
-
prevKey
KeyAction prevKey()Get the previous key action.- Returns:
- the previous key action
-
createKeyEvent
Create a key event from input code points.- Parameters:
input- the input code points- Returns:
- a KeyAction representing the input
-
setPrevKey
Set the previous key action.- Parameters:
event- the key action to set as previous
-