Class Macro

  • All Implemented Interfaces:
    Binding

    public class Macro
    extends java.lang.Object
    implements Binding
    A macro that executes a sequence of keystrokes when invoked.

    The Macro class is a type of Binding that represents a sequence of keystrokes to be executed when a key sequence bound to this macro is pressed. When triggered, the LineReader will process each keystroke in the macro's sequence as if they were typed by the user.

    Macros are useful for automating repetitive sequences of editing operations by binding them to a single key combination. They can include any valid key sequence, including control characters and escape sequences.

    For example, a macro might be used to:

    • Move the cursor to the beginning of the line and insert a specific prefix
    • Delete a word and replace it with another string
    • Execute a series of editing commands in sequence
    See Also:
    Binding, LineReader.runMacro(String)
    • Constructor Summary

      Constructors 
      Constructor Description
      Macro​(java.lang.String sequence)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getSequence()
      Returns the keystroke sequence that this macro will execute.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Macro

        public Macro​(java.lang.String sequence)
    • Method Detail

      • getSequence

        public java.lang.String getSequence()
        Returns the keystroke sequence that this macro will execute.
        Returns:
        the keystroke sequence
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object