Class Emacs

java.lang.Object
org.aesh.readline.editing.Emacs
All Implemented Interfaces:
EditMode

public class Emacs extends Object implements EditMode
Emacs-style line editing mode implementation.
Author:
Ståle W. Pedersen
  • Method Details

    • clearDefaultActions

      protected void clearDefaultActions()
      Clears all default key actions and key event actions.
    • addAction

      public void addAction(int[] input, String action)
      Description copied from interface: EditMode
      Add an action mapping by key input and action name.
      Specified by:
      addAction in interface EditMode
      Parameters:
      input - the key input code points
      action - the action name
    • remapKeysFromDevice

      public void remapKeysFromDevice(Device device)
      Description copied from interface: EditMode
      Remap keys based on device capabilities.
      Specified by:
      remapKeysFromDevice in interface EditMode
      Parameters:
      device - the terminal device
    • prevKey

      public KeyAction prevKey()
      Description copied from interface: EditMode
      Get the previous key action.
      Specified by:
      prevKey in interface EditMode
      Returns:
      the previous key action
    • setPrevKey

      public void setPrevKey(KeyAction event)
      Description copied from interface: EditMode
      Set the previous key action.
      Specified by:
      setPrevKey in interface EditMode
      Parameters:
      event - the key action to set as previous
    • addAction

      public void addAction(Key input, String action)
      Adds a key binding with the specified action name.
      Parameters:
      input - the key to bind
      action - the action name to bind to the key
    • addAction

      public Emacs addAction(Key input, Action action)
      Adds a key binding with the specified action.
      Specified by:
      addAction in interface EditMode
      Parameters:
      input - the key to bind
      action - the action to bind to the key
      Returns:
      this Emacs instance for method chaining
    • addVariable

      public void addVariable(Variable variable, String value)
      Description copied from interface: EditMode
      Add a variable with its value.
      Specified by:
      addVariable in interface EditMode
      Parameters:
      variable - the variable to set
      value - the value to assign
    • updateIgnoreEOF

      public void updateIgnoreEOF(int eof)
      Description copied from interface: EditMode
      Update the ignore-EOF counter.
      Specified by:
      updateIgnoreEOF in interface EditMode
      Parameters:
      eof - the EOF value to update
    • resetEOF

      protected void resetEOF()
      Resets the EOF counter to zero.
    • getEofCounter

      protected int getEofCounter()
      Gets the current EOF counter value.
      Returns:
      the EOF counter value
    • mode

      public EditMode.Mode mode()
      Description copied from interface: EditMode
      Get the editing mode type.
      Specified by:
      mode in interface EditMode
      Returns:
      the mode (EMACS or VI)
    • keys

      public KeyAction[] keys()
      Description copied from interface: EditMode
      Get the key actions for this mode.
      Specified by:
      keys in interface EditMode
      Returns:
      the key actions array
    • status

      public EditMode.Status status()
      Description copied from interface: EditMode
      Get the current edit status.
      Specified by:
      status in interface EditMode
      Returns:
      the current status
    • setStatus

      public void setStatus(EditMode.Status status)
      Description copied from interface: EditMode
      Set the edit status.
      Specified by:
      setStatus in interface EditMode
      Parameters:
      status - the new status
    • parse

      public Action parse(KeyAction event)
      Description copied from interface: EditMode
      Parse a key event and return the corresponding action.
      Specified by:
      parse in interface EditMode
      Parameters:
      event - the key event to parse
      Returns:
      the action for this key event, or null if none
    • isInChainedAction

      public boolean isInChainedAction()
      Description copied from interface: EditMode
      Check if currently in a chained action sequence.
      Specified by:
      isInChainedAction in interface EditMode
      Returns:
      true if in a chained action
    • variableValue

      public String variableValue(Variable variable)
      Description copied from interface: EditMode
      Get the value of a variable.
      Specified by:
      variableValue in interface EditMode
      Parameters:
      variable - the variable to look up
      Returns:
      the variable's value, or null if not set