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 org.aesh.terminal.KeyActioncreateKeyEvent(int[] input) Create a key event from input code points.booleanCheck if currently in a chained action sequence.org.aesh.terminal.KeyAction[]keys()Get the key actions for this mode.mode()Get the editing mode type.parse(org.aesh.terminal.KeyAction event) Parse a key event and return the corresponding action.org.aesh.terminal.KeyActionprevKey()Get the previous key action.voidremapKeysFromDevice(org.aesh.terminal.Device device) Remap keys based on device capabilities.voidsetPrevKey(org.aesh.terminal.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.Get the value of a variable, wrapped in an Optional.
-
Method Details
-
mode
EditMode.Mode mode()Get the editing mode type.- Returns:
- the mode (EMACS or VI)
-
keys
org.aesh.terminal.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
-
variable
Get the value of a variable, wrapped in an Optional.- Parameters:
variable- the variable to look up- Returns:
- an Optional containing the variable value, or empty 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
void remapKeysFromDevice(org.aesh.terminal.Device device) Remap keys based on device capabilities.- Parameters:
device- the terminal device
-
prevKey
org.aesh.terminal.KeyAction prevKey()Get the previous key action.- Returns:
- the previous key action
-
createKeyEvent
default org.aesh.terminal.KeyAction createKeyEvent(int[] input) Create a key event from input code points.- Parameters:
input- the input code points- Returns:
- a KeyAction representing the input
-
setPrevKey
void setPrevKey(org.aesh.terminal.KeyAction event) Set the previous key action.- Parameters:
event- the key action to set as previous
-