Package org.jline.reader
Class Macro
- java.lang.Object
-
- org.jline.reader.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()
-
-
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-