Class UndoTree<T>

java.lang.Object
org.jline.reader.impl.UndoTree<T>
Type Parameters:
T - the type of state object being tracked

public class UndoTree<T> extends Object
Provides undo/redo functionality for the LineReader.

This class implements a simple undo tree that allows tracking and restoring previous states of an object (typically the line buffer). It maintains a linear history of states that can be navigated with undo and redo operations.

Key features:

  • Tracks a sequence of states that can be undone and redone
  • Uses a consumer to apply state changes when undoing or redoing
  • Maintains the current position in the undo history

Note that the first added state (the initial state) cannot be undone.

  • Constructor Details

  • Method Details

    • clear

      public void clear()
    • newState

      public void newState(T state)
    • canUndo

      public boolean canUndo()
    • canRedo

      public boolean canRedo()
    • undo

      public void undo()
    • redo

      public void redo()