Scoop API

scoop:scoop.readline:0.1.0

src/history/history.scoop

Selected production source · src/history/history.scoop

1package scoop.readline.history
3import scoop.platform.fs.Path
5/** Direction of an inclusive history search. */
6public enum SearchDirection { Forward, Reverse }
7/** A stable entry and its history index and Unicode-scalar match position. */
8public struct SearchResult(val entry: String, val index: Long, val position: Long)
10/** Pluggable history storage and navigation used by the editor. */
11public interface History {
12 public val size: Long
13 public val isEmpty: Boolean get() = size == 0L
14 public fun get(index: Long, direction: SearchDirection = SearchDirection.Forward): SearchResult?
15 public fun add(line: String): Boolean
16 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?
24/** Optional persistence capability; memory-only backends need not implement it. */
25public interface PersistentHistory : History {
26 public fun load(path: Path)
27 public fun save(path: Path)
28 public fun append(path: Path)