HistoryFilter

ammonite.terminal.filters.HistoryFilter
See theHistoryFilter companion object
class HistoryFilter(history: () => IndexedSeq[String], commentStartColor: Attrs) extends DelegateFilter

Provides history navigation up and down, saving the current line, a well as history-search functionality (Ctrl R in bash) letting you quickly find & filter previous commands by entering a sub-string.

Attributes

Companion:
object
Graph
Supertypes
trait Filter
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def activeHistory: Boolean
def activeSearch: Boolean
def backspace(b: Vector[Char], c: Int): (Vector[Char], Int, String)
def ctrlR(b: Vector[Char], c: Int): (Vector[Char], Int, String)
def down(b: Vector[Char], c: Int): (Vector[Char], Int, String)
def endHistory(): Unit
def printableChar(char: Char)(b: Vector[Char], c: Int): (Vector[Char], Int, String)
def searchHistory(start: Int, increment: Int, buffer: Vector[Char], skipped: Vector[Char]): (Vector[Char], Int, String)
def searchOrHistoryAnd(cond: Boolean): Boolean

Predicate to check if either we're searching for a term or if we're in history-browsing mode and some predicate is true.

Predicate to check if either we're searching for a term or if we're in history-browsing mode and some predicate is true.

Very often we want to capture keystrokes in search-mode more aggressively than in history-mode, e.g. search-mode drops you out more aggressively than history-mode does, and its up/down keys cycle through history more aggressively on every keystroke while history-mode only cycles when you reach the top/bottom line of the multi-line input.

Attributes

def startHistory(b: Vector[Char], c: Int): (Vector[Char], Int, String)

Kicks the HistoryFilter from passive-mode into search-history mode

Kicks the HistoryFilter from passive-mode into search-history mode

Attributes

def up(b: Vector[Char], c: Int): (Vector[Char], Int, String)
def wrap(rest: LazyList[Int], out: (Vector[Char], Int, String)): TermState

Inherited methods

def identifier: String

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.

Attributes

Inherited from:
DelegateFilter
def op(ti: TermInfo): Option[TermAction]

Attributes

Inherited from:
DelegateFilter
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Filter -> Any
Inherited from:
Filter

Concrete fields

val dropHistoryChars: Set[Int]
var historyIndex: Int

-1 means we haven't started looking at history, n >= 0 means we're currently at history command n

-1 means we haven't started looking at history, n >= 0 means we're currently at history command n

Attributes

var prevBuffer: Option[Vector[Char]]

Records the last buffer that the filter has observed while it's in search/history mode. If the new buffer differs from this, assume that some other filter modified the buffer and drop out of search/history

Records the last buffer that the filter has observed while it's in search/history mode. If the new buffer differs from this, assume that some other filter modified the buffer and drop out of search/history

Attributes

var searchTerm: Option[Vector[Char]]

The term we're searching for, if any.

The term we're searching for, if any.

  • None means we're not searching for anything, e.g. we're just browsing history

  • Some(term) where term is not empty is what it normally looks like when we're searching for something

  • Some(term) where term is empty only really happens when you start searching and delete things, or if you Ctrl-R on an empty prompt

Attributes

Implicits

Inherited implicits

implicit val enclosing: Enclosing

Attributes

Inherited from:
DelegateFilter