Interface EditMode

All Known Implementing Classes:
Emacs, Vi

public interface EditMode
Defines the interface for line editing modes such as Emacs and Vi.
Author:
Ståle W. Pedersen
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Editing mode types.
    static enum 
    Editing status values.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAction(int[] input, String action)
    Add an action mapping by key input and action name.
    addAction(org.aesh.terminal.Key key, Action action)
    Add an action mapping for a key.
    void
    addVariable(Variable variable, String value)
    Add a variable with its value.
    default org.aesh.terminal.KeyAction
    createKeyEvent(int[] input)
    Create a key event from input code points.
    boolean
    Check if currently in a chained action sequence.
    org.aesh.terminal.KeyAction[]
    Get the key actions for this mode.
    Get the editing mode type.
    parse(org.aesh.terminal.KeyAction event)
    Parse a key event and return the corresponding action.
    org.aesh.terminal.KeyAction
    Get the previous key action.
    void
    remapKeysFromDevice(org.aesh.terminal.Device device)
    Remap keys based on device capabilities.
    void
    setPrevKey(org.aesh.terminal.KeyAction event)
    Set the previous key action.
    void
    Set the edit status.
    Get the current edit status.
    void
    updateIgnoreEOF(int eof)
    Update the ignore-EOF counter.
    variable(Variable variable)
    Get the value of a variable, wrapped in an Optional.
  • Method Details

    • 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

      void setStatus(EditMode.Status status)
      Set the edit status.
      Parameters:
      status - the new status
    • parse

      Action parse(org.aesh.terminal.KeyAction event)
      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

      void addVariable(Variable variable, String value)
      Add a variable with its value.
      Parameters:
      variable - the variable to set
      value - the value to assign
    • variable

      Optional<String> variable(Variable 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

      EditMode addAction(org.aesh.terminal.Key key, Action action)
      Add an action mapping for a key.
      Parameters:
      key - the key to map
      action - the action to perform
      Returns:
      this edit mode for chaining
    • addAction

      void addAction(int[] input, String action)
      Add an action mapping by key input and action name.
      Parameters:
      input - the key input code points
      action - 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