Class/Object

ammonite.terminal.filters

UndoFilter

Related Docs: object UndoFilter | package filters

Permalink

case class UndoFilter(maxUndo: Int = 25) extends DelegateFilter with Product with Serializable

A filter that implements "undo" functionality in the ammonite REPL. It shares the same Ctrl - hotkey that the bash undo, but shares behavior with the undo behavior in desktop text editors:

- Multiple deletes in a row get collapsed - In addition to edits you can undo cursor movements: undo will bring your cursor back to location of previous edits before it undoes them - Provides "redo" functionality under Alt -/Esc -: un-undo the things you didn't actually want to undo!

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. UndoFilter
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. DelegateFilter
  7. Filter
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new UndoFilter(maxUndo: Int = 25)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def currentUndo: (Vector[Char], Int)

    Permalink
  7. implicit val enclosing: Enclosing

    Permalink
    Definition Classes
    DelegateFilter
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def filter: Filter

    Permalink
    Definition Classes
    UndoFilterDelegateFilter
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def identifier: String

    Permalink

    the .toString of this object, except by making it separate we force the implementer to provide something and stop them from accidentally leaving it as the meaningless default.

    the .toString of this object, except by making it separate we force the implementer to provide something and stop them from accidentally leaving it as the meaningless default.

    Definition Classes
    DelegateFilterFilter
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. val maxUndo: Int

    Permalink
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def op(ti: TermInfo): Option[TermAction]

    Permalink
    Definition Classes
    DelegateFilterFilter
  19. def pushUndos(b: Vector[Char], c: Int): Unit

    Permalink
  20. def redo(b: Vector[Char], c: Int): (Vector[Char], Int, Str)

    Permalink
  21. var state: UndoState

    Permalink

    An enum representing what the user is "currently" doing.

    An enum representing what the user is "currently" doing. Used to collapse sequential actions into one undo step: e.g. 10 plain chars typed becomes 1 undo step, or 10 chars deleted becomes one undo step, but 4 chars typed followed by 3 chars deleted followed by 3 chars typed gets grouped into 3 different undo steps

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    Filter → AnyRef → Any
  24. def undo(b: Vector[Char], c: Int): (Vector[Char], Int, Str)

    Permalink
  25. val undoBuffer: Buffer[(Vector[Char], Int)]

    Permalink

    The current stack of states that undo/redo would cycle through.

    The current stack of states that undo/redo would cycle through.

    Not really the appropriate data structure, since when it reaches maxUndo in length we remove one element from the start whenever we append one element to the end, which costs O(n). On the other hand, It also costs O(n) to maintain the buffer of previous states, and so n is probably going to be pretty small anyway (tens?) so O(n) is perfectly fine.

  26. var undoIndex: Int

    Permalink

    The current position in the undoStack that the terminal is currently in.

  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def wrap(bc: (Vector[Char], Int, Str), rest: LazyList[Int]): TermState

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from DelegateFilter

Inherited from Filter

Inherited from AnyRef

Inherited from Any

Ungrouped