scoop:scoop.readline:0.1.0
src/history/history.scoop
Selected production source · src/history/history.scoop
1
package scoop.readline.history3
import scoop.platform.fs.Path5
/** Direction of an inclusive history search. */6
public enum SearchDirection { Forward, Reverse }7
/** A stable entry and its history index and Unicode-scalar match position. */8
public struct SearchResult(val entry: String, val index: Long, val position: Long)10
/** Pluggable history storage and navigation used by the editor. */11
public interface History {12
public val size: Long13
public val isEmpty: Boolean get() = size == 0L14
public fun get(index: Long, direction: SearchDirection = SearchDirection.Forward): SearchResult?15
public fun add(line: String): Boolean16
public fun clear()17
public fun setMaxLength(length: Long)18
public fun setIgnoreDuplicates(ignore: Boolean)19
public fun setIgnoreSpace(ignore: Boolean)20
public fun search(term: String, start: Long, direction: SearchDirection): SearchResult?21
public fun startsWith(term: String, start: Long, direction: SearchDirection): SearchResult?22
}24
/** Optional persistence capability; memory-only backends need not implement it. */25
public interface PersistentHistory : History {26
public fun load(path: Path)27
public fun save(path: Path)28
public fun append(path: Path)29
}