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
  • Method Details

    • 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

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

      Action parse(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
    • variableValue

      String variableValue(Variable variable)
      Get the value of a variable.
      Parameters:
      variable - the variable to look up
      Returns:
      the variable's value, or null if not set
    • addAction

      EditMode addAction(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(Device device)
      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

      default 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(KeyAction event)
      Set the previous key action.
      Parameters:
      event - the key action to set as previous