# Ranvier.Plume # Ranvier.Plume ![The native EditorShowcase with a document open](/Ranvier.Plume/editor-showcase.png) Start with [installation and your first edit](guide/introduction.md). Then [bind a command](guide/keymaps.md) or [mount the editor view](guide/view.md). | If you need to… | Read | | --- | --- | | Share a file between panes, save it or follow its changes | [Documents and transactions](guide/documents.md) | | Add editor state, settings or syntax highlighting | [Extensions](guide/extensions.md) | | Find a module or inspect a signature | [API reference](guide/api.md) | | Run the showcase, tests and performance probes | [Development and measurement](guide/development.md) | --- # API reference | Package | | |---|---| | [`Ranvier.Plume`](/Ranvier.Plume/reference/ranvier-plume/) | 50 declarations | | [`Ranvier.Plume.View`](/Ranvier.Plume/reference/ranvier-plume-view/) | 24 declarations | --- # API reference Browse the generated [state API](https://ranvier-org.github.io/Ranvier.Plume/reference/ranvier-plume/) and [view API](https://ranvier-org.github.io/Ranvier.Plume/reference/ranvier-plume-view/) for signatures, members and XML comments from the release assemblies. The packages include XML documentation beside each assembly for editor completion. The linked modules contain the signatures, discriminated unions and remarks for this release. - [Text](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Text.fs) — immutable text and line operations. - [ChangeSet](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/ChangeSet.fs) — position mapping across edits. - [Selection](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Selection.fs) — ranges, anchors and primary selection. - [RangeSet](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/RangeSet.fs) — position-indexed ranges. - [Transaction](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Transaction.fs) — edit specifications, effects and annotations. - [State](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/State.fs) — facets, state fields, compartments and precedence. - [History](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/History.fs) — undo and redo state. - [Document](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Document.fs) — shared log, save point and readers. - [Editor](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Editor.fs) — per-pane state and update readers. - [Columns](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Columns.fs) — visual columns, tabs and offset conversion. - [Commands](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Commands.fs) — movement, selection and editing commands. - [Keymap](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Keymap.fs) — typed bindings, precedence and multi-stroke dispatch. - [Language](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume/Language.fs) — line tokenizers, tags and highlight styles. - [Styling](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume.View/Styling.fs) — editor themes and class rules. - [Types](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume.View/Types.fs) — view props, geometry, plugins, layers and gutters. - [Features](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume.View/Features.fs) — built-in view features. - [Decoration](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume.View/Decoration.fs) — typed marks, diagnostic underlines and hover templates. - [Component](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/src/Ranvier.Plume.View/Component.fs) — component creation and mounted-view lookup. --- # Development and measurement The [verification guide](verification.md) explains the Rocq models, Iris heap proof and comparisons with compiled F#. From the checkout, run these commands in separate invocations. ```sh dotnet run -c Release --project samples/EditorShowcase dotnet fsi --exec build.fsx -- ci dotnet fsi --exec build.fsx -- check dotnet fsi --exec build.fsx -- traced dotnet run --project docs/docs.fsproj -c Release -- build --strict ``` The first command opens the native editor. The CI target builds the solution and runs every state and view test. The check target also needs the global `rfs` tool. The traced target verifies the traced package family in a copy of the source tree. For a hidden-window frame benchmark, append `-- --bench` to the showcase command. Use `--memory` for retained history, `--load` for the line scan, and `--writes` for row writes during typing and scrolling. Compare like workloads from the same probe. The [acceptance report](https://github.com/ranvier-org/Ranvier.Plume/blob/main/docs/ACCEPTANCE.md) describes the environment and links the results to the [design dossier](https://github.com/ranvier-org/Ranvier.Plume/blob/main/docs/DOSSIER.md). For documentation clients, the site also publishes a [page index](/Ranvier.Plume/llms.txt) and [combined Markdown guide](/Ranvier.Plume/llms-full.txt). --- # Documents and transactions A document owns the text shared by its editors. An editor owns a selection and extension configuration. Reading `editor.Text.Value` or `editor.Selection.Value` inside a Ranvier effect subscribes that effect to subsequent changes. ```text editor command → transaction specs → document log → document text and history ↓ editor state and selection ↓ visible rows ``` An edit range is half-open. Offsets count UTF-16 code units and lines are zero-based. A supplementary character occupies two code units. Screen columns also depend on tabs and wide characters. Use editor movement commands for caret navigation and the view’s coordinate mapping when handling a pointer. Group related specs into one `editor.Dispatch` call. Use `Tx.change` to replace a range and `Tx.userEvent` to describe its origin. To submit against a previously observed document revision, use `Document.DispatchAt` with that revision. Independent consumers can obtain their own `document.Reader()` or `editor.Updates()` and read changes since their previous read. For a save operation, persist the text snapshot, then call `document.MarkSaved()` when the saved snapshot is still current. Observe `document.IsDirty.Value` for a modified indicator. History belongs to the document. Its undo and redo depths are available as memos, and `Commands.undo` and `Commands.redo` operate through an editor. --- # State and view extensions | Requirement | Plume primitive | | --- | --- | | Combine contributions from several extensions | Define a `Facet` and install contributions with its `Of` member. Read the result through `editor.Facet`. | | Keep a value that evolves with transactions | Define a `StateField` with initialization and update logic. Read it through `editor.Field`. | | Replace a group of extensions while the editor is open | Install a `Compartment` and dispatch `Tx.effect (slot.Reconfigure replacement)`. | | Attach state or behavior to a mounted view | Define a `ViewPlugin`, install its extension and use `ViewPlugin.tryGet` on the mounted view. | For syntax highlighting, create a line tokenizer with `Language.ofLineLexer` and install it with `Language.extension`. Return token spans relative to the line and assign a `Tag` to each span. Describe the presentation separately using `HighlightStyle.define`. Keeping the token data independent of CSS lets a theme change without rewriting the lexer. The showcase implements a working [lexer](https://github.com/ranvier-org/Ranvier.Plume/blob/main/samples/EditorShowcase/Lexer.fs) and [reconfigurable editor](https://github.com/ranvier-org/Ranvier.Plume/blob/main/samples/EditorShowcase/App.fs). --- # Installation and your first edit Install the state library for a headless tool, or install the view package to bring in the editor state and native view dependencies together. ```sh dotnet add package Ranvier.Plume --version 0.2.0 # For a project which mounts the editor: dotnet add package Ranvier.Plume.View --version 0.2.0 ``` Both libraries target .NET 8 and .NET 10. For a traced Ranvier application use `Ranvier.Plume.Traced` and `Ranvier.Plume.View.Traced` throughout. The state package also includes Fable sources. The view package ships compiled .NET assemblies. Call this function from component setup or another Ranvier owner. It creates an editor with the standard editing and history shortcuts and changes the name in a declaration. ```fsharp open Ranvier.Plume let openExample () = let document = Document.create (Text.ofString "let answer = 42\n") let editor = Editor.create document [ Keymap.extension Keymap.defaults ] editor.Dispatch [ Tx.change { From = 4; To = 10; Insert = Text.ofString "result" } Tx.userEvent "input.type" ] Text.toString editor.Text.Value // "let result = 42\n" ``` Store the document for as long as the file is open. Create an editor for each pane that needs its own selection. [Documents and transactions](documents.md) explains the two lifetimes. --- # Typed shortcuts Use Ranvier.Keyboard’s `chord` expression at declaration sites. It builds a typed logical key with a modifier mask. Reordering modifiers gives the same shortcut. The list passed to Plume preserves the order of successive strokes. ```fsharp open System.Text open Ranvier.Keyboard open Ranvier.Plume let prefix = chord { ctrl; key (Character (Rune 'k')) } let select = chord { ctrl; key (Character (Rune 'a')) } let left = chord { key (Navigation ArrowLeft) } let bindings = Keymap.extension [ Keymap.bindChords [ prefix; select ] Commands.selectAll Keymap.bindChordsWithShift [ left ] Commands.cursorCharLeft Commands.selectCharLeft ] ``` Pass `bindings` in the extensions list when creating the editor. A command returns a Boolean indicating whether it applied. Plume tries exact bindings in precedence order, then a Shift variant for the last stroke. Use the logical character delivered by the event for an explicit shifted printable binding, for example uppercase `Rune 'Z'` for Ctrl+Shift+Z. The mounted view handles input. In a custom host, call `Keymap.run editor pending stroke`. Retain the returned strokes on `Pending strokes`, consume the event on `Handled`, and allow ordinary input on `Unhandled`. Reset pending strokes after completion or cancellation. Keep pending state per input context. `Keymap.standard` provides movement, selection, deletion, indentation and select-all. `Keymap.history` adds undo and redo. `Keymap.defaults` combines them. For a text configuration file, parse a binding with `Keymap.bind` or `Keymap.bindShift`. --- # Verifying editor invariants A slow reader can hold a document’s transaction history open while faster readers advance. Plume remembers the index of a reader that previously held the oldest revision. On the next append it checks that the index still names a live reader at the current cut. A match proves that trimming would remove nothing. A miss runs the minimum scan again. Disposing a reader can shift every subsequent index, so remembering an index alone would be insufficient. The Rocq theorem `hinted_cut_exact` covers every possible index, including an out-of-range index. The remaining retention proofs establish that every live reader sees its complete unread suffix. An Iris proof checks that the fallback scan leaves each reader's cursor and fractional permission intact. For changes to text, the model compares the back-to-front splice implementation with a forward edit specification. Inverting stamped changes restores the original sequence. For materialization, `fill_frame` proves that writing a subtree into its assigned region produces the concatenated text while preserving both surrounding regions. ## Comparing editor performance Use the full-feature editor from v0.2.0 as the control for focused typing and scrolling. Keep IME, clipboard, accessible selection and decorations enabled in both builds. Compare paired whole-turn timings on the same machine. The v0.1.1 timings remain available for historical comparisons. [Benchmark protocol and measurements](https://github.com/ranvier-org/Ranvier.Plume/blob/v0.2.0/docs/bench/full-feature-baseline.md) ## Running the checks Run `opam exec -- bash proofs/check.sh` with the toolchain from the proof workflow. The script compiles the Release F# editor, records its results as executable Rocq examples, compiles the proofs, checks their assumptions and verifies the compiled dependencies. The examples include owner disposal, older transaction bases, mixed line endings, multiple leaves, and edits inside a UTF-16 surrogate pair. The proofs describe algorithms over mathematical sequences. The differential checks are the link to the implementation. For example, the first all-offsets comparison found that the rope could turn a lone low surrogate into U+FFFD. The fix preserves the exact contents of affected lines and the reproducer now runs on every proof build. [Proof sources and scope](https://github.com/ranvier-org/Ranvier.Plume/tree/main/proofs) · [Surrogate regression](https://github.com/ranvier-org/Ranvier.Plume/issues/3) --- # Mounting and styling the editor Create the component definition once. Supply the editor and its host frame scheduler through props. In a Ranvier.View template, the mounted component follows the current props. ```fsharp open Ranvier.View.Dsl open Ranvier.Plume.View let editorView = EditorView.create EditorView.defaults // FileSlot is the showcase's model for an open file. let fileView = render editorView.Component (fun (file: FileSlot) -> { Editor = file.Editor; Scheduler = file.Scheduler }) ``` After mounting, `EditorView.current editor` returns a value option. Use the mounted view’s `Focus()`, `ScrollTo` or `ScrollBy` to drive it. Read `Viewport` to follow the visible lines. `PosAtCoords` maps a viewport point to a text offset, and `CoordsAtPos` returns the character rectangle on the sheet. Use `Gutter.define` to place a marker beside each visible line. Its key function declares which extra state can invalidate the markers. Use `Layer.define` for rectangles above or below the text. Assign classes to markers and supply their rules through the host stylesheet. The showcase’s [style definitions](https://github.com/ranvier-org/Ranvier.Plume/blob/main/samples/EditorShowcase/Styles.fs) and [stylesheet assembly](https://github.com/ranvier-org/Ranvier.Plume/blob/main/samples/EditorShowcase/LiveSheet.fs) show how they reach the native renderer. ## Text entry and accessible selection `EditorView.accessibleName.Of "Source editor"` names the native multiline editing control. A focused view exposes the main selection, its direction, and surrounding lines to the host. The native context spans the selected lines and a line on each side when available. It expands for a multiline selection. Plume converts the native LF offsets to document UTF-16 offsets, including across CRLF. Setting the native selection updates the editor. The native input method owns provisional composition. Its preedit appears at the caret. Commit applies one editor command, and cancellation discards the preedit. A document or selection change during composition invalidates its pending commit. The clipboard uses plain text. Copy and cut join multiple selections with the configured line separator. When the number of pasted lines matches the number of carets, each caret receives its corresponding line. Read-only editors support selection and copying. ## Typed decorations `Decoration.mark` positions a Ranvier.View template over each visible line segment of a half-open document range. `Decoration.underline` draws the mark and takes a Dsl template for its hover. The template receives a reader for the typed range payload. The range source can read editor fields or Ranvier memos. ```fsharp type Diagnostic = { Code: string; Message: string } let hover: TemplateView Diagnostic> = span () { strong () { fun read -> (read()).Code } " " fun read -> (read()).Message } let diagnostics (field: StateField>) = Decoration.underline "diagnostic" (fun view -> view.Editor.Field(field).Value) hover ``` For diagnostics, call `Decoration.mapUntouched (ChangeSet.desc tx.Changes) ranges` from the field update. An edit inside the marked text removes the diagnostic. Edits before it move it, and insertions at either boundary stay outside the mark. In EditorShowcase, choose **Go to diagnostic** to stop the tour and reveal the example. Hover the underlined `Mu: float` declaration near the top of the sample file. Editing inside the declaration dismisses the diagnostic. --- # Ranvier.Plume.View | Namespace | | |---|---| | [`Ranvier.Plume.View`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/) | 24 declarations | --- # Ranvier.Plume.View ## Modules | | | Assembly | |---|---|---| | [`ActiveLine`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/activeline/) | A band behind the line of the main cursor, and the active mark on that line's gutter cell | `Ranvier.Plume.View` | | [`Cursor`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/cursor/) | A cursor at the head of every range | `Ranvier.Plume.View` | | [`Decoration`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/decoration/) | Document-anchored marks | `Ranvier.Plume.View` | | [`DrawSelection`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/drawselection/) | Rectangles behind the text of every selected range | `Ranvier.Plume.View` | | [`Gutter`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/gutter/) | | `Ranvier.Plume.View` | | [`Layer`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/layer/) | | `Ranvier.Plume.View` | | [`LineNumbers`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/linenumbers/) | A gutter of line numbers | `Ranvier.Plume.View` | | [`ViewFacets`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/viewfacets/) | The facets of an editor that its views read | `Ranvier.Plume.View` | ## Records | | | Assembly | |---|---|---| | [`CursorConfig`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/cursorconfig/) | How the cursor is drawn | `Ranvier.Plume.View` | | [`EditorView`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/editorview/) | A mounted editor view: what a view plugin, a layer or a host reads and calls | `Ranvier.Plume.View` | | [`EditorViewDefinition`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/editorviewdefinition/) | An editor view ready to mount, and the CSS it needs | `Ranvier.Plume.View` | | [`EditorViewProps`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/editorviewprops/) | What an editor view is mounted with | `Ranvier.Plume.View` | | [`GutterMarker`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/guttermarker/) | What a gutter shows beside a line | `Ranvier.Plume.View` | | [`GutterSpec`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/gutterspec/) | A column beside the text | `Ranvier.Plume.View` | | [`LayerMarker`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/layermarker/) | A rectangle a layer draws | `Ranvier.Plume.View` | | [`LayerSpec`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/layerspec/) | Positioned rectangles drawn below or above the text | `Ranvier.Plume.View` | | [`LineNumbersConfig`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/linenumbersconfig/) | How line numbers are shown | `Ranvier.Plume.View` | | [`Rect`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/rect/) | A rectangle in CSS pixels on the sheet the rows lie on | `Ranvier.Plume.View` | | [`Theme`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/theme/) | The look of an editor view | `Ranvier.Plume.View` | | [`ViewConfig`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/viewconfig/) | How an editor view is built | `Ranvier.Plume.View` | | [`VisibleRange`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/visiblerange/) | The lines a view shows, and the offsets of the first and last of them | `Ranvier.Plume.View` | ## Union | | | Assembly | |---|---|---| | [`CursorShape`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/cursorshape/) | The shape of the cursor | `Ranvier.Plume.View` | ## Classes | | | Assembly | |---|---|---| | [`ViewPlugin`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/viewplugin/) | Code that runs for as long as a view is mounted with it, and the value it made for the view | `Ranvier.Plume.View` | | [`ViewPluginBase`](/Ranvier.Plume/reference/ranvier-plume-view/ranvier-plume-view/viewpluginbase/) | A view plugin, without its value type | `Ranvier.Plume.View` | --- # ActiveLine
module ActiveLine
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | A band behind the line of the main cursor, and the active mark on that line's gutter cell. ## Functions and values
extension: Extension
--- # Cursor
module Cursor
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | A cursor at the head of every range. ## Functions and values
defaults: CursorConfig
A bar that blinks every 530 ms.
extension (config: CursorConfig) : Extension
--- # CursorConfig
type CursorConfig =
    {
        Shape: CursorShape
        BlinkRate: float
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | How the cursor is drawn. ## Fields
Shape: CursorShape
BlinkRate: float
Milliseconds the cursor stays lit and then dark; 0 for a cursor that stays lit.
--- # CursorShape
type CursorShape =
    | Bar
    | Block
    | Underline
| | | |---|---| | Assembly | `Ranvier.Plume.View` | The shape of the cursor. ## Cases
Bar
Block
Underline
## Properties
member IsBar: bool
member IsBlock: bool
member IsUnderline: bool
--- # Decoration
module Decoration
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | Document-anchored marks. Ranges use half-open UTF-16 offsets. ## Functions and values
mapUntouched<'T> (changes: ChangeDesc) (ranges: RangeSet<'T>) : RangeSet<'T>
Carries ranges across disjoint edits and removes a mark when its text is edited. Insertions at the start or end are outside the range.
mark<'a> (className: string) (ranges: EditorView -> RangeSet<'a>) (template: TemplateView<(unit -> 'a)>) : Extension
Places a typed template over each visible line segment of a range.
underline<'T> (className: string) (ranges: EditorView -> RangeSet<'T>) (hover: TemplateView<(unit -> 'T)>) : Extension
Underlines each visible segment and shows its typed template on pointer hover.
--- # DrawSelection
module DrawSelection
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | Rectangles behind the text of every selected range. ## Functions and values
extension: Extension
--- # EditorView
type EditorView =
    {
        Editor: Editor
        Scheduler: FrameScheduler
        Theme: Theme
        Viewport: Memo<VisibleRange>
        HasFocus: Memo<bool>
        ScrollTop: Memo<float>
        Height: Memo<float>
        CharWidth: Memo<float>
        GutterWidth: Memo<float>
        Focus: unit -> unit
        ScrollTo: float -> unit
        ScrollBy: float -> unit
        PosAtCoords: float -> float -> int
        CoordsAtPos: int -> Rect
        RunFrame: unit -> unit
        RowsWritten: unit -> int64
        MarkupStats: unit -> struct (int64 * int64)
        ResetMarkup: unit -> unit
        PluginValue: int -> obj voption
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | A mounted editor view: what a view plugin, a layer or a host reads and calls. ## Fields
Editor: Editor
Scheduler: FrameScheduler
The host's frames and timers.
Theme: Theme
Viewport: Memo<VisibleRange>
The lines shown.
HasFocus: Memo<bool>
ScrollTop: Memo<float>
The distance scrolled from the document's top, in CSS pixels, as the rows are laid out for.
Height: Memo<float>
The height of the viewport in CSS pixels.
CharWidth: Memo<float>
The advance of one character in CSS pixels, measured from the page.
GutterWidth: Memo<float>
The width of the gutters, where the text starts.
Focus: unit -> unit
Gives the view the keyboard focus.
ScrollTo: float -> unit
Scrolls to a distance from the document's top at the next frame.
ScrollBy: float -> unit
Scrolls by a distance at the next frame.
PosAtCoords: float -> float -> int
The offset under a point of the viewport, in CSS pixels from its top-left corner.
CoordsAtPos: int -> Rect
The rectangle of the character at an offset, on the sheet. A tracked read: a layer that calls it follows the text, the font and the sheet.
RunFrame: unit -> unit
Runs the work of a frame now: lays the rows out for the scroll position asked for. A scripted run calls it in place of the frame callback.
RowsWritten: unit -> int64
The number of rows computed since the view was mounted.
MarkupStats: unit -> struct (int64 * int64)
The lines whose markup came from the cache, and the lines whose markup was built, since the cache was last emptied.
ResetMarkup: unit -> unit
Empties the markup cache and its counts.
PluginValue: int -> obj voption
The value a view plugin made for the view, by the plugin's id. A tracked read.
## Functions and values
accessibleName: Facet<string,string>
The accessible name of the native editing control.
compositorLayer: Facet<bool,bool>
True when the sheet is promoted to a compositor layer. Default false.
create (config: ViewConfig) : EditorViewDefinition
The view component for a theme, with the classes and rules it needs. The component is defined once and mounted any number of times; each mount takes an editor and the frame scheduler of its host.
current (editor: Editor) : EditorView voption
The view mounted on editor.
defaults: ViewConfig
The dark theme, six rows of overscan, and an anchor that moves every 700 lines.
markupCache: Facet<bool,bool>
True when the markup of a line is kept by the line's text. Default true.
recycleRows: Facet<bool,bool>
True when a line keeps its row element for as long as it stays in the row pool. Default true.
scrollIntoView: StateEffectType<int>
An effect that scrolls a position into view in the views of the editor that dispatches it.
--- # EditorViewDefinition
type EditorViewDefinition =
    {
        Component: Component<EditorViewProps>
        Styles: StyleDefinition list
        Rules: Rule list
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | An editor view ready to mount, and the CSS it needs. ## Fields
Component: Component<EditorViewProps>
Styles: StyleDefinition list
The classes the view applies, each with its rules. A host adds them to the stylesheet it serves.
Rules: Rule list
The theme's rules for tokens, layers and gutters. A host adds them to the same stylesheet.
--- # EditorViewProps
type EditorViewProps =
    {
        Editor: Editor
        Scheduler: FrameScheduler
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | What an editor view is mounted with. ## Fields
Editor: Editor
Scheduler: FrameScheduler
The frames and timers of the host the view is mounted in.
--- # Gutter
module Gutter
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | ## Functions and values
define (spec: GutterSpec) : Extension
The extension that adds a gutter.
facet: Facet<GutterSpec,GutterSpec array>
The gutters of an editor's views, in order from the left.
--- # GutterMarker
[<Struct>]
type GutterMarker =
    {
        Text: string
        Class: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | What a gutter shows beside a line. ## Fields
Text: string
Class: string
--- # GutterSpec
type GutterSpec =
    {
        Class: string
        Width: float
        LineMarker: EditorState -> Line -> GutterMarker voption
        Key: EditorState -> obj
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | A column beside the text. ## Fields
Class: string
A word a theme rule selects the gutter's markers by.
Width: float
The column's width in CSS pixels.
LineMarker: EditorState -> Line -> GutterMarker voption
The marker of a line, or ValueNone for an empty cell.
Key: EditorState -> obj
A value of the state the markers depend on beside the line itself. The markers of every row are computed again when it changes; a gutter that reads the line alone returns a constant.
--- # Layer
module Layer
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | ## Functions and values
define (spec: LayerSpec) : Extension
The extension that adds a layer.
facet: Facet<LayerSpec,LayerSpec array>
The layers of an editor's views.
--- # LayerMarker
type LayerMarker =
    {
        Rect: Rect
        Class: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | A rectangle a layer draws. Class is a word a theme rule selects by. ## Fields
Rect: Rect
Class: string
--- # LayerSpec
type LayerSpec =
    {
        Above: bool
        Class: string
        Markers: EditorView -> LayerMarker array
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | Positioned rectangles drawn below or above the text. ## Fields
Above: bool
True to draw above the text.
Class: string
A word a theme rule selects the layer's markers by.
Markers: EditorView -> LayerMarker array
The rectangles. Reads of memos and of CoordsAtPos are tracked.
--- # LineNumbers
module LineNumbers
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | A gutter of line numbers. ## Functions and values
defaults: LineNumbersConfig
Decimal numbers in a column of 48 CSS pixels.
extension (config: LineNumbersConfig) : Extension
--- # LineNumbersConfig
type LineNumbersConfig =
    {
        Format: int -> string
        Width: float
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` `[]` | How line numbers are shown. ## Fields
Format: int -> string
The text of a 1-based line number.
Width: float
The width of the column in CSS pixels.
--- # Rect
[<Struct>]
type Rect =
    {
        Left: float
        Top: float
        Width: float
        Height: float
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | A rectangle in CSS pixels on the sheet the rows lie on. ## Fields
Left: float
Top: float
Width: float
Height: float
--- # Theme
type Theme =
    {
        FontFamily: string
        FontSize: float
        LineHeight: float
        Ink: string
        Faint: string
        Accent: string
        Background: string
        Edge: string
        Selection: string
        ActiveLine: string
        Thumb: string
        Tokens: (Tag * string * (string * string) list) list
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | The look of an editor view. Colours are CSS colour values. ## Fields
FontFamily: string
A CSS font-family list. A column is one character advance wide, so the font is monospaced.
FontSize: float
The font size in CSS pixels.
LineHeight: float
The height of a row in CSS pixels.
Ink: string
Text.
Faint: string
Gutter text.
Accent: string
The cursor.
Background: string
Edge: string
The gutter's edge and the scrollbar track's edge.
Selection: string
ActiveLine: string
Thumb: string
The scrollbar thumb.
Tokens: (Tag * string * (string * string) list) list
The look of each token tag: a class name for the token's span, and CSS declarations as property and value.
## Functions and values
dark: Theme
A dark theme.
define (theme: Theme) : Theme
| Raises | | |---|---| | `System.ArgumentException` | The font size or the line height is not positive, or a token class name is empty. |
--- # ViewConfig
type ViewConfig =
    {
        Theme: Theme
        Overscan: int
        RebaseLines: int
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | How an editor view is built. ## Fields
Theme: Theme
Overscan: int
Rows kept above and below the lines shown.
RebaseLines: int
Lines the first line shown may move from the sheet's anchor line before the anchor moves to it.
--- # ViewFacets
module ViewFacets
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | The facets of an editor that its views read. ## Functions and values
accessibleName: Facet<string,string>
The accessible name of the native editing control.
activeLineGutter: Facet<bool,bool>
True when the gutter cell of the main cursor's line is marked active. Default false.
compositorLayer: Facet<bool,bool>
True when the sheet is promoted to a compositor layer. Default false.
cursorShape: Facet<CursorShape,CursorShape>
The shape of the cursor. Default a bar.
markupCache: Facet<bool,bool>
True when the markup of a line is kept by the line's text. Default true.
recycleRows: Facet<bool,bool>
True when a line keeps its row element for as long as it stays in the row pool. Default true.
scrollIntoView: StateEffectType<int>
An effect that scrolls a position into view in the views of the editor that dispatches it.
--- # ViewPlugin
[<Class>]
type ViewPlugin<'T> =
    define<'T> (create: EditorView -> 'T) : ViewPlugin<'T>
    extension<'T> (plugin: ViewPlugin<'T>) : Extension
    facet: Facet<ViewPluginBase,ViewPluginBase array>
    tryGet<'T> (plugin: ViewPlugin<'T>) (view: EditorView) : 'T voption
    member CreateBoxed (view: EditorView) : obj
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Inherits | `ViewPluginBase` | | Attributes | `[]` | Code that runs for as long as a view is mounted with it, and the value it made for the view. ## Functions and values
define<'T> (create: EditorView -> 'T) : ViewPlugin<'T>
A plugin. create runs when a view is mounted with the plugin, under an owner of its own: effects and cleanups it registers last until the view unmounts or the plugins of the editor change.
extension<'T> (plugin: ViewPlugin<'T>) : Extension
The extension that adds plugin.
facet: Facet<ViewPluginBase,ViewPluginBase array>
The plugins of an editor's views.
tryGet<'T> (plugin: ViewPlugin<'T>) (view: EditorView) : 'T voption
The value plugin made for view. A tracked read.
## Methods
member CreateBoxed (view: EditorView) : obj
--- # ViewPluginBase
[<AbstractClass>]
type ViewPluginBase =
    abstract member CreateBoxed (view: EditorView) : obj
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | A view plugin, without its value type. ## Methods
abstract member CreateBoxed (view: EditorView) : obj
--- # VisibleRange
[<Struct>]
type VisibleRange =
    {
        FirstLine: int
        LastLine: int
        From: int
        To: int
    }
| | | |---|---| | Assembly | `Ranvier.Plume.View` | | Attributes | `[]` | The lines a view shows, and the offsets of the first and last of them. ## Fields
FirstLine: int
LastLine: int
From: int
To: int
--- # Ranvier.Plume | Namespace | | |---|---| | [`Ranvier.Plume`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/) | 50 declarations | --- # Ranvier.Plume ## Modules | | | Assembly | |---|---|---| | [`Annotations`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/annotations/) | The annotations the library reads | `Ranvier.Plume` | | [`Columns`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/columns/) | The column grid of a line | `Ranvier.Plume` | | [`Commands`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/commands/) | | `Ranvier.Plume` | | [`History`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/history/) | | `Ranvier.Plume` | | [`Keymap`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/keymap/) | | `Ranvier.Plume` | | [`Tx`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/tx/) | The parts a transaction is built from | `Ranvier.Plume` | ## Records | | | Assembly | |---|---|---| | [`ChangeDesc`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/changedesc/) | The shape of a change: which ranges of a document are replaced, and by how many characters | `Ranvier.Plume` | | [`ChangeSpec`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/changespec/) | A replacement of [From, To) by Insert | `Ranvier.Plume` | | [`DocumentConfig`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/documentconfig/) | What a document starts from | `Ranvier.Plume` | | [`EditorSelection`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/editorselection/) | One or more selected ranges, sorted and apart, one of them the main range | `Ranvier.Plume` | | [`EditorStateConfig`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/editorstateconfig/) | What an editor state starts from | `Ranvier.Plume` | | [`HistoryConfig`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/historyconfig/) | How a document's history groups and bounds its items | `Ranvier.Plume` | | [`HistoryState`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/historystate/) | The history of a document as a fold over its transactions: the edits that can be undone and redone, and the document's position among them | `Ranvier.Plume` | | [`KeyBinding`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/keybinding/) | A command bound to a key or a sequence of keys | `Ranvier.Plume` | | [`Language`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/language/) | How the lines of a language divide into tokens | `Ranvier.Plume` | | [`Line`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/line/) | A line of a text | `Ranvier.Plume` | | [`LineEdit`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/lineedit/) | An edit addressed by 0-based line and UTF-16 character, as the Language Server Protocol does | `Ranvier.Plume` | | [`SelectionRange`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/selectionrange/) | A selected range | `Ranvier.Plume` | | [`StateFieldSpec`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/statefieldspec/) | How a state field starts and how a transaction changes it | `Ranvier.Plume` | | [`Tag`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/tag/) | A kind of token a theme gives a look to | `Ranvier.Plume` | | [`Token`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/token/) | A tagged span of a line, in UTF-16 units from the line's start | `Ranvier.Plume` | | [`Transaction`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/transaction/) | One atomic edit, as data | `Ranvier.Plume` | | [`Update`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/update/) | What changed in an editor between two reads of an update reader | `Ranvier.Plume` | ## Unions | | | Assembly | |---|---|---| | [`Extension`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/extension/) | A value added to an editor's configuration: a facet input, a state field, or a group of these | `Ranvier.Plume` | | [`KeymapResult`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/keymapresult/) | What a key did | `Ranvier.Plume` | | [`TxSpec`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/txspec/) | A part of a transaction under construction | `Ranvier.Plume` | ## Classes | | | Assembly | |---|---|---| | [`Annotation`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/annotation/) | A typed piece of metadata on a transaction | `Ranvier.Plume` | | [`AnnotationType`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/annotationtype/) | A kind of annotation holding a 'T | `Ranvier.Plume` | | [`ChangeSet`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/changeset/) | A change to a document of one length: the shape, and for each replaced range the text inserted and the text removed | `Ranvier.Plume` | | [`Compartment`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/compartment/) | A part of a configuration that a transaction can replace | `Ranvier.Plume` | | [`Document`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/document/) | One file: the log of its transactions, its saved text and its current text | `Ranvier.Plume` | | [`Editor`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/editor/) | One view of a document: its own extensions, selection, fields and facets over the document's text | `Ranvier.Plume` | | [`EditorState`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/editorstate/) | The state of an editor at one position of its document's log: the text, the selection, and the values of the configured fields and facets | `Ranvier.Plume` | | [`Facet`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/facet/) | A point where extensions add inputs, combined into one value an editor reads | `Ranvier.Plume` | | [`FacetBase`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/facetbase/) | A facet, without its value types | `Ranvier.Plume` | | [`FieldBase`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/fieldbase/) | A state field, without its value type | `Ranvier.Plume` | | [`HighlightStyle`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/highlightstyle/) | The CSS class of each tag | `Ranvier.Plume` | | [`LogReader`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/logreader/) | A reader of a document's log | `Ranvier.Plume` | | [`RangeSet`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/rangeset/) | Ranges with a value each, sorted by start and then by end | `Ranvier.Plume` | | [`StateEffect`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/stateeffect/) | A typed side effect carried by a transaction, for state fields and views to act on | `Ranvier.Plume` | | [`StateEffectType`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/stateeffecttype/) | A kind of state effect, without its value type | `Ranvier.Plume` | | [`StateField`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/statefield/) | A value kept in the editor state and updated by every transaction | `Ranvier.Plume` | | [`Text`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/text/) | An immutable text | `Ranvier.Plume` | | [`TokenCache`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/tokencache/) | The tokens of the lines of one language, kept by line text | `Ranvier.Plume` | | [`UpdateReader`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/updatereader/) | A reader of an editor's transactions | `Ranvier.Plume` | ## Enums | | | Assembly | |---|---|---| | [`Assoc`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/assoc/) | The side a position stays on when text is inserted at it | `Ranvier.Plume` | | [`MapMode`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/mapmode/) | When mapping a position reports the deletion of its surroundings | `Ranvier.Plume` | | [`Prec`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/prec/) | The order facet inputs take: inputs of a higher precedence come first, and within one precedence the order of the extension list holds | `Ranvier.Plume` | ## Type abbreviations | | | Assembly | |---|---|---| | [`Command`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/command/) | An action on an editor | `Ranvier.Plume` | | [`StateCommand`](/Ranvier.Plume/reference/ranvier-plume/ranvier-plume/statecommand/) | A command over a state and a function that dispatches a transaction, so it runs without an editor | `Ranvier.Plume` | --- # Annotation
[<Class>]
type Annotation =
    define<'T> () : AnnotationType<'T>
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A typed piece of metadata on a transaction. ## Functions and values
define<'T> () : AnnotationType<'T>
A new kind of annotation.
--- # Annotations
module Annotations
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The annotations the library reads. ## Functions and values
addToHistory: AnnotationType<bool>
False on a transaction that history leaves out.
group: AnnotationType<int64>
The history item the transaction belongs to. Transactions with one group id form one item in each document.
isolateHistory: AnnotationType<bool>
True on a transaction that stands alone in history.
time: AnnotationType<int64>
When the transaction was made, in milliseconds on its document's clock.
userEvent: AnnotationType<string>
What the user did, as dot-separated words from general to specific: "input.type", "delete.backward".
--- # AnnotationType
[<Class>]
type AnnotationType<'T> =
    member Of (value: 'T) : Annotation
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A kind of annotation holding a 'T. ## Methods
member Of (value: 'T) : Annotation
An annotation of this kind.
--- # Assoc
type Assoc =
    | Before = -1
    | After = 1
| | | |---|---| | Assembly | `Ranvier.Plume` | | Inherits | `Enum` | The side a position stays on when text is inserted at it. ## Cases
Before = -1
After = 1
--- # ChangeDesc
[<Struct>]
type ChangeDesc =
    {
        Sections: int array
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` `[]` | The shape of a change: which ranges of a document are replaced, and by how many characters. Sections holds pairs of a length in the document and the number of characters replacing it, -1 for a range left alone. ## Fields
Sections: int array
## Functions and values
compose (a: ChangeDesc) (b: ChangeDesc) : ChangeDesc
The shape of a followed by b, where b applies to the document a produces.
invert (desc: ChangeDesc) : ChangeDesc
The shape of the change that undoes desc.
isEmpty (desc: ChangeDesc) : bool
True when the change replaces no range.
iterChangedRanges (f: int -> int -> int -> int -> unit) (desc: ChangeDesc) : unit
Calls f fromA toA fromB toB for each replaced range, adjacent ranges as one: the range in the document the change applies to, and the range in the document it produces.
length (desc: ChangeDesc) : int
The length of the document the change applies to.
map (before: bool) (other: ChangeDesc) (desc: ChangeDesc) : ChangeDesc
mapPos (assoc: Assoc) (position: int) (desc: ChangeDesc) : int
Where position lies after the change. A position inside a replaced range maps to the range's start with Assoc.Before and to the end of the inserted text with Assoc.After.
mapPosMode (assoc: Assoc) (mode: MapMode) (position: int) (desc: ChangeDesc) : int voption
newLength (desc: ChangeDesc) : int
The length of the document the change produces.
touchesRange (from: int) (to': int) (desc: ChangeDesc) : bool
True when a replaced range touches [from, to'].
--- # ChangeSet
[<Class>]
type ChangeSet =
    apply (doc: Text) (changes: ChangeSet) : Text
    compose (a: ChangeSet) (b: ChangeSet) : ChangeSet
    desc (changes: ChangeSet) : ChangeDesc
    empty (length: int) : ChangeSet
    invert (changes: ChangeSet) : ChangeSet
    isEmpty (changes: ChangeSet) : bool
    iterChanges (f: int -> int -> int -> int -> Text -> unit) (changes: ChangeSet) : unit
    length (changes: ChangeSet) : int
    map (before: bool) (other: ChangeDesc) (changes: ChangeSet) : ChangeSet
    mapPos (assoc: Assoc) (position: int) (changes: ChangeSet) : int
    newLength (changes: ChangeSet) : int
    ofLineEdits (doc: Text) (edits: LineEdit list) : ChangeSet
    ofSpecs (doc: Text) (specs: ChangeSpec list) : ChangeSet
    toLineEdits (doc: Text) (changes: ChangeSet) : LineEdit list
    member Inserted: Text array
    member Removed: Text array
    member Sections: int array
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A change to a document of one length: the shape, and for each replaced range the text inserted and the text removed. ## Functions and values
apply (doc: Text) (changes: ChangeSet) : Text
| Raises | | |---|---| | `System.ArgumentException` | `doc` has another length than the change applies to. |
compose (a: ChangeSet) (b: ChangeSet) : ChangeSet
desc (changes: ChangeSet) : ChangeDesc
empty (length: int) : ChangeSet
The change that leaves a document of length characters as it is.
invert (changes: ChangeSet) : ChangeSet
The change that undoes changes.
isEmpty (changes: ChangeSet) : bool
True when the change replaces no range.
iterChanges (f: int -> int -> int -> int -> Text -> unit) (changes: ChangeSet) : unit
Calls f fromA toA fromB toB inserted for each replaced range, adjacent ranges as one.
length (changes: ChangeSet) : int
The length of the document the change applies to.
map (before: bool) (other: ChangeDesc) (changes: ChangeSet) : ChangeSet
mapPos (assoc: Assoc) (position: int) (changes: ChangeSet) : int
Where position lies after the change.
newLength (changes: ChangeSet) : int
The length of the document the change produces.
ofLineEdits (doc: Text) (edits: LineEdit list) : ChangeSet
The change edits make to doc.
ofSpecs (doc: Text) (specs: ChangeSpec list) : ChangeSet
The change specs make to doc. Specs address doc and may come in any order; specs at one position apply in list order. A spec lies outside doc, ends before it starts, or overlaps another.
toLineEdits (doc: Text) (changes: ChangeSet) : LineEdit list
The change as edits addressing doc, the document it applies to.
## Properties
member Inserted: Text array
The text inserted by each replaced range, in order.
member Removed: Text array
The text removed by each replaced range, in order.
member Sections: int array
Pairs of a length in the document and the number of characters replacing it, -1 for a range left alone.
--- # ChangeSpec
[<Struct>]
type ChangeSpec =
    {
        From: int
        To: int
        Insert: Text
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A replacement of [From, To) by Insert. ## Fields
From: int
To: int
Insert: Text
--- # Columns
module Columns
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The column grid of a line. A column is one character advance wide, and every character takes a whole number of columns: a tab reaches to the next multiple of the tab size, a wide character takes two, and a letter with its combining marks is one character. Moving up and down a line keeps a column of this grid, and a view draws a line by it, so the place of a position is a multiplication. ## Functions and values
clusterColumns (line: string) (at: int) (length: int) (column: int) (tabSize: int) : int
The columns of the character of length units at at, when it starts at column column. A tab size below 1 is taken as 1.
clusterLength (line: string) (at: int) : int
The length in UTF-16 units of the character that starts at at: a grapheme cluster.
columnOf (line: string) (tabSize: int) (offset: int) : int
The column where the character holding unit offset of the line starts; the line's width for an offset at or past its end.
isPlain (line: string) : bool
True when every UTF-16 unit of the line is a character of one column: printable ASCII and nothing else.
offsetAt (line: string) (tabSize: int) (column: float) : int
The offset in the line of the character boundary nearest to column columns from the line's start. A column at a character's middle goes after the character.
widthAt (line: string) (tabSize: int) (offset: int) : int
The columns the character at offset takes; one at or past the line's end.
--- # Command
type Command = Editor -> bool
| | | |---|---| | Assembly | `Ranvier.Plume` | An action on an editor. True when the action applied; false lets the next binding of a key run. --- # Commands
module Commands
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | ## Functions and values
cursorCharLeft: Command
cursorCharRight: Command
cursorDocEnd: Command
cursorDocStart: Command
cursorGroupLeft: Command
cursorGroupRight: Command
cursorLineDown: Command
cursorLineEnd: Command
cursorLineStart: Command
cursorLineUp: Command
cursorPageDown: Command
cursorPageUp: Command
Moves up by the number of lines in Editor.PageLines.
cutSelection: Command
Deletes selected text as one cut transaction.
deleteCharBackward: Command
Deletes every range, or the character before a cursor.
deleteCharForward: Command
Deletes every range, or the character after a cursor.
insertNewline: Command
Replaces every range by the state's line separator.
insertNewlineKeepIndent: Command
Replaces every range by a line break and the white space the range's line starts with.
insertTab: Command
Inserts the state's indent unit.
insertText (text: string) : Command
Replaces every range by text.
ofState (command: StateCommand) (editor: Editor) : bool
pasteText (text: string) : Command
Pastes one line per range when their counts match. Otherwise each range receives the full text.
redo: Command
Redoes the history item last undone.
selectAll: Command
selectCharLeft: Command
selectCharRight: Command
selectDocEnd: Command
selectDocStart: Command
selectGroupLeft: Command
selectGroupRight: Command
selectLine: Command
Selects the lines of every range, each with its line break.
selectLineDown: Command
selectLineEnd: Command
selectLineStart: Command
selectLineUp: Command
selectPageDown: Command
selectPageUp: Command
undo: Command
Undoes the document's last history item.
--- # Compartment
[<Class>]
type Compartment =
    create () : Compartment
    member Of (content: Extension) : Extension
    member Reconfigure (content: Extension) : StateEffect
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A part of a configuration that a transaction can replace. ## Functions and values
create () : Compartment
## Methods
member Of (content: Extension) : Extension
An extension holding content as the compartment's first content.
member Reconfigure (content: Extension) : StateEffect
An effect that replaces the compartment's content.
--- # Document
[<Class>]
type Document =
    create (text: Text) : Document
    createWith (config: DocumentConfig) : Document
    member Head: Signal<int64>
    member History: Memo<HistoryState>
    member IsDirty: Memo<bool>
    member RedoDepth: Memo<int>
    member Saved: Memo<Text>
    member Text: Memo<Text>
    member UndoDepth: Memo<int>
    member Dispatch (specs: TxSpec list) : unit
    member DispatchAt (baseSeq: int64, specs: TxSpec list) : unit
    member MarkSaved () : unit
    member Post (specs: TxSpec list) : unit
    member PostAt (baseSeq: int64, specs: TxSpec list) : unit
    member Reader () : LogReader
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | One file: the log of its transactions, its saved text and its current text. The log is the source of truth; the text, the history and every editor of the document follow it. ## Functions and values
create (text: Text) : Document
A document of text with History.defaults and the system's tick clock.
createWith (config: DocumentConfig) : Document
A document of config.Text, with its nodes owned by the current owner.
## Properties
member Head: Signal<int64>
The position of the last transaction; 0 for a document without one. Writing it is the log's own step.
member History: Memo<HistoryState>
member IsDirty: Memo<bool>
True when the current text differs from the saved text. Undoing back to the saved position gives false.
member RedoDepth: Memo<int>
The number of history items that can be redone.
member Saved: Memo<Text>
The text when the document was created or last marked saved.
member Text: Memo<Text>
The current text.
member UndoDepth: Memo<int>
The number of history items that can be undone.
## Methods
member Dispatch (specs: TxSpec list) : unit
Appends the transaction specs describe, from a source outside every editor. Every editor of the document applies its changes and its effects. Runs on the graph's thread.
member DispatchAt (baseSeq: int64, specs: TxSpec list) : unit
Appends the transaction specs describe, from a source outside every editor, written against the document at position baseSeq. Its changes are moved over the transactions appended since. Runs on the graph's thread. The log holds no transaction of position baseSeq + 1: every reader has passed it.
member MarkSaved () : unit
Takes the current text as the saved text.
member Post (specs: TxSpec list) : unit
member PostAt (baseSeq: int64, specs: TxSpec list) : unit
member Reader () : LogReader
A reader of the log, starting at the head and owned by the current owner. The log keeps every transaction a reader has yet to read, so a reader is read regularly or disposed.
--- # DocumentConfig
type DocumentConfig =
    {
        Text: Text
        History: HistoryConfig
        Clock: unit -> int64
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` | What a document starts from. ## Fields
Text: Text
History: HistoryConfig
Clock: unit -> int64
Milliseconds on a monotonic clock, for the time of each transaction.
--- # Editor
[<Class>]
type Editor =
    create (document: Document) (extensions: Extension list) : Editor
    redo (editor: Editor) : bool
    undo (editor: Editor) : bool
    member Document: Document
    member Id: int
    member PageLines: Signal<int>
    member Selection: Memo<EditorSelection>
    member State: Memo<EditorState>
    member Text: Memo<Text>
    member Dispatch (specs: TxSpec list) : unit
    member Facet<'In, 'Out> (facet: Facet<'In,'Out>) : Memo<'Out>
    member Field<'T> (field: StateField<'T>) : Memo<'T>
    member Updates () : UpdateReader
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | One view of a document: its own extensions, selection, fields and facets over the document's text. ## Functions and values
create (document: Document) (extensions: Extension list) : Editor
An editor of document with a cursor at 0, owned by the current owner.
redo (editor: Editor) : bool
Redoes the item last undone. False with nothing to redo or a read-only state.
undo (editor: Editor) : bool
Undoes the document's last history item. False with nothing to undo or a read-only state.
## Properties
member Document: Document
member Id: int
A number that identifies the editor as the source of its transactions.
member PageLines: Signal<int>
The number of lines a page motion moves by. A view writes the number of lines it shows.
member Selection: Memo<EditorSelection>
The selection. Its readers stay asleep while a transaction leaves the selection where it is.
member State: Memo<EditorState>
The editor's state at the head of the document's log.
member Text: Memo<Text>
## Methods
member Dispatch (specs: TxSpec list) : unit
Appends the transaction specs describe to the document's log, in one batch. A transaction that changes the document and carries a user event is dropped while EditorState.readOnly is true. A change lies outside the document or overlaps another.
member Facet<'In, 'Out> (facet: Facet<'In,'Out>) : Memo<'Out>
The value of facet, as a memo kept for the editor's life. The first call for a facet runs outside a memo's body.
member Field<'T> (field: StateField<'T>) : Memo<'T>
The value of field, as a memo kept for the editor's life. The first call for a field runs outside a memo's body.
member Updates () : UpdateReader
A reader of the editor's transactions, starting at the current state and owned by the current owner. The document's log keeps every transaction a reader has yet to read.
--- # EditorSelection
type EditorSelection =
    {
        Ranges: SelectionRange array
        MainIndex: int
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | One or more selected ranges, sorted and apart, one of them the main range. ## Fields
Ranges: SelectionRange array
MainIndex: int
## Functions and values
asSingle (selection: EditorSelection) : EditorSelection
The main range alone.
clamp (length: int) (selection: EditorSelection) : EditorSelection
The selection with every position inside [0, length].
create (ranges: SelectionRange list) (mainIndex: int) : EditorSelection
A selection of ranges, sorted, with overlapping ranges merged. The main range is the one that holds the range at mainIndex. ranges is empty or mainIndex is outside it.
cursor (position: int) : SelectionRange
map (changes: ChangeDesc) (selection: EditorSelection) : EditorSelection
The selection after changes. A cursor stays before text inserted at it; a range keeps the text it covered.
range (anchor: int) (head: int) : SelectionRange
single (anchor: int) (head: int) : EditorSelection
A selection of one range.
## Properties
member Main: SelectionRange
--- # EditorState
[<Class>]
type EditorState =
    allowMultipleSelections: Facet<bool,bool>
    appendConfig: StateEffectType<Extension>
    apply (transaction: Transaction) (state: EditorState) : EditorState
    create (config: EditorStateConfig) : EditorState
    facet<'In, 'Out> (facet: Facet<'In,'Out>) (state: EditorState) : 'Out
    field<'T> (field: StateField<'T>) (state: EditorState) : 'T
    indentUnit: Facet<string,string>
    lineSeparator: Facet<string,string>
    readOnly: Facet<bool,bool>
    reconfigure: StateEffectType<Extension>
    tabSize: Facet<int,int>
    transaction (specs: TxSpec list) (state: EditorState) : Transaction
    tryField<'T> (field: StateField<'T>) (state: EditorState) : 'T voption
    member Doc: Text
    member Selection: EditorSelection
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The state of an editor at one position of its document's log: the text, the selection, and the values of the configured fields and facets. Immutable. ## Functions and values
allowMultipleSelections: Facet<bool,bool>
True when a selection keeps more than one range. Default false.
appendConfig: StateEffectType<Extension>
An effect that adds an extension to the configuration.
apply (transaction: Transaction) (state: EditorState) : EditorState
create (config: EditorStateConfig) : EditorState
facet<'In, 'Out> (facet: Facet<'In,'Out>) (state: EditorState) : 'Out
The value of facet in state.
field<'T> (field: StateField<'T>) (state: EditorState) : 'T
The value of field in state. The configuration lacks the field.
indentUnit: Facet<string,string>
The text one level of indentation inserts. Default four spaces.
lineSeparator: Facet<string,string>
The line break inserted text uses. Default "\n".
readOnly: Facet<bool,bool>
True when user events leave the document alone. Default false.
reconfigure: StateEffectType<Extension>
An effect that replaces the whole configuration. Fields of the new configuration keep their values.
tabSize: Facet<int,int>
The width of a tab in columns. Default 4.
transaction (specs: TxSpec list) (state: EditorState) : Transaction
The transaction specs describe for state, with positions in the log of 0. A change lies outside the document or overlaps another.
tryField<'T> (field: StateField<'T>) (state: EditorState) : 'T voption
The value of field in state, or ValueNone when the configuration lacks the field.
## Properties
member Doc: Text
member Selection: EditorSelection
--- # EditorStateConfig
type EditorStateConfig =
    {
        Doc: Text
        Selection: EditorSelection voption
        Extensions: Extension list
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | What an editor state starts from. ## Fields
Doc: Text
Selection: EditorSelection voption
The selection, or a cursor at 0.
Extensions: Extension list
--- # Extension
type Extension =
    | Many of Extension list
    | WithPrec of Prec * Extension
    | FacetInput of FacetBase * obj
    | FacetComputed of FacetBase * EditorState -> obj
    | Field of FieldBase
    | InCompartment of Compartment * Extension
| | | |---|---| | Assembly | `Ranvier.Plume` | A value added to an editor's configuration: a facet input, a state field, or a group of these. ## Cases
Many of Extension list
WithPrec of Prec * Extension
FacetInput of FacetBase * obj
FacetComputed of FacetBase * EditorState -> obj
Field of FieldBase
InCompartment of Compartment * Extension
## Functions and values
many (extensions: Extension list) : Extension
The extensions of extensions, in order.
prec (prec: Prec) (extension: Extension) : Extension
--- # Facet
[<Class>]
type Facet<'In, 'Out> =
    compute<'In, 'Out> (facet: Facet<'In,'Out>) (compute: EditorState -> 'In) : Extension
    define<'In, 'Out> (combine: 'In array -> 'Out) : Facet<'In,'Out>
    from<'In, 'Out, 'T> (facet: Facet<'In,'Out>) (field: StateField<'T>) (get: 'T -> 'In) : Extension
    member CombineBoxed (inputs: obj array) : obj
    member Of (value: 'In) : Extension
| | | |---|---| | Assembly | `Ranvier.Plume` | | Inherits | `FacetBase` | | Attributes | `[]` | A point where extensions add inputs, combined into one value an editor reads. ## Functions and values
compute<'In, 'Out> (facet: Facet<'In,'Out>) (compute: EditorState -> 'In) : Extension
An extension that adds compute state to facet, computed again for each state.
define<'In, 'Out> (combine: 'In array -> 'Out) : Facet<'In,'Out>
A new facet. combine receives the inputs in precedence order, and an empty array when no extension adds one.
from<'In, 'Out, 'T> (facet: Facet<'In,'Out>) (field: StateField<'T>) (get: 'T -> 'In) : Extension
An extension that adds get value to facet, where value is the value of field. The extension holds the field.
## Methods
member CombineBoxed (inputs: obj array) : obj
member Of (value: 'In) : Extension
An extension that adds value to the facet.
--- # FacetBase
[<AbstractClass>]
type FacetBase =
    abstract member CombineBoxed (inputs: obj array) : obj
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A facet, without its value types. ## Methods
abstract member CombineBoxed (inputs: obj array) : obj
--- # FieldBase
[<AbstractClass>]
type FieldBase =
    abstract member Provided: Extension list
    abstract member CreateBoxed (state: EditorState) : obj
    abstract member UpdateBoxed (value: obj, transaction: Transaction) : obj
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A state field, without its value type. ## Properties
abstract member Provided: Extension list
## Methods
abstract member CreateBoxed (state: EditorState) : obj
abstract member UpdateBoxed (value: obj, transaction: Transaction) : obj
--- # HighlightStyle
[<Class>]
type HighlightStyle =
    classOf (tag: Tag) (style: HighlightStyle) : string voption
    define (classes: (Tag * string) list) : HighlightStyle
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The CSS class of each tag. ## Functions and values
classOf (tag: Tag) (style: HighlightStyle) : string voption
The class of tag in style.
define (classes: (Tag * string) list) : HighlightStyle
A style giving each tag of classes its class name.
--- # History
module History
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | ## Functions and values
defaults: HistoryConfig
10,000 items, a new item after 500 ms, and edits joined when their ranges touch. An item of a single-character edit was measured at 279 bytes (`docs/ACCEPTANCE.md`, 7.2), so a full history of them holds about 2.8 MB.
newGroupId () : int64
A group id no other call returned. Transactions annotated with one id form one history item in each document they change.
undoOp: AnnotationType<bool>
Set on a transaction made by undo (true) or redo (false).
--- # HistoryConfig
type HistoryConfig =
    {
        Depth: int
        NewGroupDelay: int64
        JoinToEvent: Transaction -> bool -> bool
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` | How a document's history groups and bounds its items. ## Fields
Depth: int
The number of items that can be undone; a number below 1 is taken as 1.
NewGroupDelay: int64
Milliseconds after which an edit starts a new item.
JoinToEvent: Transaction -> bool -> bool
Decides whether an edit joins the item before it; receives the transaction and whether its ranges touch that item's.
--- # HistoryState
type HistoryState =
    {
        Config: HistoryConfig
        Done: HistoryStack
        Undone: HistoryStack
        Epoch: int64
        Position: int64
        LastPosition: int64
        PrevTime: int64
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` | The history of a document as a fold over its transactions: the edits that can be undone and redone, and the document's position among them. ## Fields
Config: HistoryConfig
Done: HistoryStack
Undone: HistoryStack
Epoch: int64
Raised by every change history leaves out; positions of different epochs are different texts.
Position: int64
LastPosition: int64
PrevTime: int64
The time of the last edit recorded, for grouping.
## Functions and values
apply (transaction: Transaction) (state: HistoryState) : HistoryState
empty (config: HistoryConfig) : HistoryState
position (state: HistoryState) : struct (int64 * int64)
The document's position. Two equal positions of one document are the same text.
redoDepth (state: HistoryState) : int
The number of items that can be redone.
redoSpec (source: int) (selection: EditorSelection) (state: HistoryState) : TxSpec list voption
The transaction that redoes the last item undone; ValueNone with no item to redo.
undoDepth (state: HistoryState) : int
The number of items that can be undone.
undoSpec (source: int) (selection: EditorSelection) (state: HistoryState) : TxSpec list voption
The transaction that undoes the last item, for the editor source whose selection is selection; ValueNone with no item to undo. The editor that made the item gets back the selection it had before it.
--- # KeyBinding
type KeyBinding =
    {
        Keys: KeyChord list
        Run: Command
        Shift: Command voption
        Scope: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` | A command bound to a key or a sequence of keys. ## Fields
Keys: KeyChord list
The strokes, in order.
Run: Command
Shift: Command voption
The command for the same strokes with Shift held on the last one.
Scope: string
Where the binding applies; "" for the editor.
--- # Keymap
module Keymap
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | ## Functions and values
bind (keys: string) (command: Command) : KeyBinding
Bind a space-separated sequence in editor key notation.
bindChords (keys: KeyChord list) (command: Command) : KeyBinding
Bind an ordered sequence of typed strokes to a command.
bindChordsWithShift (keys: KeyChord list) (command: Command) (shifted: Command) : KeyBinding
Bind a sequence with an alternate command for Shift on the final stroke.
bindShift (keys: string) (command: Command) (shifted: Command) : KeyBinding
chord (stroke: string) : KeyChord
The chord of one stroke: modifiers and a W3C key name joined by "-", as in "Ctrl-z", "Ctrl-Shift-z", "Shift-ArrowLeft", "Enter". The stroke names no key or an unknown modifier.
defaults: KeyBinding list
extension (bindings: KeyBinding list) : Extension
An extension that adds bindings.
facet: Facet<KeyBinding list,KeyBinding array>
The bindings of an editor, in precedence order.
history: KeyBinding list
Undo on Ctrl-z; redo on Ctrl-y and Ctrl-Shift-z.
run (editor: Editor) (pending: KeyChord list) (chord: KeyChord) : KeymapResult
Runs the bindings of editor for chord, pressed after the strokes of pending. Bindings run in precedence order until a command applies. With Shift held and no binding for the chord, the Shift command of a binding for the chord without Shift runs.
standard: KeyBinding list
Motion, selection and editing keys.
--- # KeymapResult
type KeymapResult =
    | Handled
    | Pending of KeyChord list
    | Unhandled
| | | |---|---| | Assembly | `Ranvier.Plume` | What a key did. ## Cases
Handled
A command applied.
Pending of KeyChord list
The strokes so far start a longer binding.
Unhandled
## Properties
member IsHandled: bool
member IsPending: bool
member IsUnhandled: bool
--- # Language
type Language =
    {
        Name: string
        Tokenize: string -> Token array
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` | How the lines of a language divide into tokens. ## Fields
Name: string
Tokenize: string -> Token array
The tokens of a line, in order and apart. Text between tokens has no tag.
## Functions and values
extension (language: Language) : Extension
An extension that sets the editor's language.
facet: Facet<Language,Language voption>
The language of an editor: the first by precedence.
ofLineLexer (name: string) (tokenize: string -> Token array) : Language
A language whose tokenizer reads one line at a time and keeps no state between lines.
--- # Line
[<Struct>]
type Line =
    {
        Number: int
        From: int
        To: int
        Text: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A line of a text. ## Fields
Number: int
The line's 0-based number.
From: int
The offset of the line's first character.
To: int
The offset after the line's last character, before its line break.
Text: string
The line's characters, without its line break.
--- # LineEdit
type LineEdit =
    {
        StartLine: int
        StartCharacter: int
        EndLine: int
        EndCharacter: int
        NewText: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | An edit addressed by 0-based line and UTF-16 character, as the Language Server Protocol does. ## Fields
StartLine: int
StartCharacter: int
EndLine: int
EndCharacter: int
NewText: string
--- # LogReader
[<Class>]
type LogReader =
    member Read () : Transaction array
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A reader of a document's log. ## Methods
member Read () : Transaction array
The transactions appended since the reader's last value, in order. A tracked read.
--- # MapMode
type MapMode =
    | Simple = 0
    | TrackDel = 1
    | TrackBefore = 2
    | TrackAfter = 3
| | | |---|---| | Assembly | `Ranvier.Plume` | | Inherits | `Enum` | When mapping a position reports the deletion of its surroundings. ## Cases
Simple = 0
The position always maps.
TrackDel = 1
Reports a deletion across the position.
TrackBefore = 2
Reports a deletion of the character before the position.
TrackAfter = 3
Reports a deletion of the character after the position.
--- # Prec
type Prec =
    | Highest = 0
    | High = 1
    | Default = 2
    | Low = 3
    | Lowest = 4
| | | |---|---| | Assembly | `Ranvier.Plume` | | Inherits | `Enum` | The order facet inputs take: inputs of a higher precedence come first, and within one precedence the order of the extension list holds. ## Cases
Highest = 0
High = 1
Default = 2
Low = 3
Lowest = 4
--- # RangeSet
[<Class>]
type RangeSet<'T> =
    between<'T> (from: int) (to': int) (f: int -> int -> 'T -> unit) (set: RangeSet<'T>) : unit
    compare<'T when 'T: equality> (a: RangeSet<'T>) (b: RangeSet<'T>) : (int * int) list
    count<'T> (set: RangeSet<'T>) : int
    empty<'T>: RangeSet<'T>
    iter<'T> (f: int -> int -> 'T -> unit) (set: RangeSet<'T>) : unit
    join<'T> (sets: RangeSet<'T> list) : RangeSet<'T>
    map<'T> (changes: ChangeDesc) (set: RangeSet<'T>) : RangeSet<'T>
    ofRanges<'T> (ranges: (int * int * 'T) list) : RangeSet<'T>
    update<'T> (add: (int * int * 'T) list) (filter: int -> int -> 'T -> bool) (set: RangeSet<'T>) : RangeSet<'T>
    member Count: int
    member From: int array
    member To: int array
    member Values: 'T array
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | Ranges with a value each, sorted by start and then by end. Positions are held in two flat arrays beside the values. ## Functions and values
between<'T> (from: int) (to': int) (f: int -> int -> 'T -> unit) (set: RangeSet<'T>) : unit
Calls f from to value for every range that touches [from, to'], in order.
compare<'T when 'T: equality> (a: RangeSet<'T>) (b: RangeSet<'T>) : (int * int) list
The ranges held by one of a and b and not the other, as positions, overlapping ranges merged.
count<'T> (set: RangeSet<'T>) : int
empty<'T>: RangeSet<'T>
iter<'T> (f: int -> int -> 'T -> unit) (set: RangeSet<'T>) : unit
Calls f from to value for every range, in order.
join<'T> (sets: RangeSet<'T> list) : RangeSet<'T>
The ranges of every set of sets.
map<'T> (changes: ChangeDesc) (set: RangeSet<'T>) : RangeSet<'T>
The ranges after changes. A range covers the text it covered before: text inserted at either end stays outside. A range whose text is deleted is dropped; a range without text stays.
ofRanges<'T> (ranges: (int * int * 'T) list) : RangeSet<'T>
The set of ranges, each a start, an end and a value.
update<'T> (add: (int * int * 'T) list) (filter: int -> int -> 'T -> bool) (set: RangeSet<'T>) : RangeSet<'T>
The ranges of set that pass filter, with add.
## Properties
member Count: int
member From: int array
member To: int array
member Values: 'T array
--- # SelectionRange
[<Struct>]
type SelectionRange =
    {
        Anchor: int
        Head: int
        GoalColumn: int
        Assoc: Assoc
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A selected range. The head is the end that moves when the selection is extended; a cursor has both ends at one position. ## Fields
Anchor: int
Head: int
GoalColumn: int
The column of the grid (Columns) that vertical motion aims for, or -1.
Assoc: Assoc
The side of its position a cursor belongs to.
## Properties
member From: int
member IsEmpty: bool
member To: int
--- # StateCommand
type StateCommand = EditorState -> (TxSpec list -> unit) -> bool
| | | |---|---| | Assembly | `Ranvier.Plume` | A command over a state and a function that dispatches a transaction, so it runs without an editor. --- # StateEffect
[<Class>]
type StateEffect =
    define<'T> (map: 'T -> ChangeDesc -> 'T voption) : StateEffectType<'T>
    defineSimple<'T> () : StateEffectType<'T>
    mapEffects (changes: ChangeDesc) (effects: StateEffect array) : StateEffect array
    tryValue<'T> (effectType: StateEffectType<'T>) (effect: StateEffect) : 'T voption
    member Is<'T> (effectType: StateEffectType<'T>) : bool
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A typed side effect carried by a transaction, for state fields and views to act on. ## Functions and values
define<'T> (map: 'T -> ChangeDesc -> 'T voption) : StateEffectType<'T>
A new kind of effect. map moves a value over a change made before the effect applies; an effect mapped to ValueNone is dropped.
defineSimple<'T> () : StateEffectType<'T>
A new kind of effect whose value holds no position.
mapEffects (changes: ChangeDesc) (effects: StateEffect array) : StateEffect array
tryValue<'T> (effectType: StateEffectType<'T>) (effect: StateEffect) : 'T voption
The value of effect when it is of kind effectType.
## Methods
member Is<'T> (effectType: StateEffectType<'T>) : bool
True when the effect is of kind effectType.
--- # StateEffectType
[<AbstractClass>]
type StateEffectType =
    abstract member MapBoxed (value: obj, changes: ChangeDesc) : obj voption
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A kind of state effect, without its value type. ## Methods
abstract member MapBoxed (value: obj, changes: ChangeDesc) : obj voption
--- # StateField
[<Class>]
type StateField<'T> =
    define<'T> (spec: StateFieldSpec<'T>) : StateField<'T>
    defineWith<'T> (compare: 'T -> 'T -> bool) (provide: (StateField<'T> -> Extension) list) (spec: StateFieldSpec<'T>) : StateField<'T>
    extension<'T> (field: StateField<'T>) : Extension
    member Provided: Extension list
    member CreateBoxed (state: EditorState) : obj
    member UpdateBoxed (value: obj, transaction: Transaction) : obj
| | | |---|---| | Assembly | `Ranvier.Plume` | | Inherits | `FieldBase` | | Attributes | `[]` | A value kept in the editor state and updated by every transaction. ## Functions and values
define<'T> (spec: StateFieldSpec<'T>) : StateField<'T>
A new field. A field's update receives the transaction; a value that depends on the text is a computed facet.
defineWith<'T> (compare: 'T -> 'T -> bool) (provide: (StateField<'T> -> Extension) list) (spec: StateFieldSpec<'T>) : StateField<'T>
A new field. compare returns true for two values a reader takes as one; provide lists the extensions added with the field.
extension<'T> (field: StateField<'T>) : Extension
The extension that adds field to a configuration.
## Properties
member Provided: Extension list
## Methods
member CreateBoxed (state: EditorState) : obj
member UpdateBoxed (value: obj, transaction: Transaction) : obj
--- # StateFieldSpec
type StateFieldSpec<'T> =
    {
        Create: EditorState -> 'T
        Update: 'T -> Transaction -> 'T
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | How a state field starts and how a transaction changes it. ## Fields
Create: EditorState -> 'T
Update: 'T -> Transaction -> 'T
--- # Tag
[<Struct>]
type Tag =
    {
        Id: int
        Name: string
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` `[]` `[]` | A kind of token a theme gives a look to. ## Fields
Id: int
Name: string
## Functions and values
comment: Tag
define (name: string) : Tag
A new tag named name.
functionName: Tag
keyword: Tag
number: Tag
operator: Tag
punctuation: Tag
string: Tag
typeName: Tag
variable: Tag
--- # Text
[<Class>]
type Text =
    append (a: Text) (b: Text) : Text
    contentEquals (a: Text) (b: Text) : bool
    empty: Text
    iterLines (fromLine: int) (toLine: int) (text: Text) : string seq
    iterRange (from: int) (to': int) (text: Text) : string seq
    length (text: Text) : int
    line (number: int) (text: Text) : Line
    lineAt (offset: int) (text: Text) : Line
    lineText (number: int) (text: Text) : string
    lines (text: Text) : int
    ofLines (lines: string seq) : Text
    ofString (text: string) : Text
    ofUtf8 (bytes: ReadOnlySpan<byte>) : Text
    ofUtf8Scalar (bytes: ReadOnlySpan<byte>) : Text
    offsetOf (line: int) (character: int) (text: Text) : int
    positionOf (offset: int) (text: Text) : struct (int * int)
    replace (from: int) (to': int) (insert: Text) (text: Text) : Text
    slice (from: int) (to': int) (text: Text) : Text
    sliceString (from: int) (to': int) (text: Text) : string
    toString (text: Text) : string
    member Length: int
    member Lines: int
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | An immutable text. An edit shares every leaf it leaves alone with the text it was made from. Offsets are UTF-16 code units and count each line break by its characters. Equality is by reference; Text.contentEquals compares characters. ## Functions and values
append (a: Text) (b: Text) : Text
contentEquals (a: Text) (b: Text) : bool
True when a and b hold the same characters.
empty: Text
iterLines (fromLine: int) (toLine: int) (text: Text) : string seq
The characters of lines [fromLine, toLine), without line breaks.
iterRange (from: int) (to': int) (text: Text) : string seq
The characters of [from, to') in order, one string per line, line breaks included.
length (text: Text) : int
line (number: int) (text: Text) : Line
The line with 0-based number number.
lineAt (offset: int) (text: Text) : Line
The line holding offset. An offset inside a line break belongs to the line the break ends.
lineText (number: int) (text: Text) : string
The characters of line number. A line an edit left alone returns the string instance it returned before the edit while its leaf still holds the strings it decoded: the 64 leaves decoded most recently in the process hold theirs, and an older leaf holds its until a garbage collection. After that the line returns an equal string that is another instance.
lines (text: Text) : int
ofLines (lines: string seq) : Text
The text of lines joined with "\n".
ofString (text: string) : Text
ofUtf8 (bytes: ReadOnlySpan<byte>) : Text
The text of UTF-8 bytes, without a byte order mark.
ofUtf8Scalar (bytes: ReadOnlySpan<byte>) : Text
offsetOf (line: int) (character: int) (text: Text) : int
The offset of character in line line. A character beyond the line gives the line's end.
positionOf (offset: int) (text: Text) : struct (int * int)
The line and character of offset. An offset inside a line break gives the end of the line's characters.
replace (from: int) (to': int) (insert: Text) (text: Text) : Text
slice (from: int) (to': int) (text: Text) : Text
The text of [from, to'). A slice of more than a few lines shares the leaves of whole lines.
sliceString (from: int) (to': int) (text: Text) : string
The characters of [from, to').
toString (text: Text) : string
## Properties
member Length: int
The number of UTF-16 code units, line breaks included.
member Lines: int
The number of lines; a text without characters has one.
--- # Token
[<Struct>]
type Token =
    {
        From: int
        To: int
        Tag: Tag
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A tagged span of a line, in UTF-16 units from the line's start. ## Fields
From: int
To: int
Tag: Tag
--- # TokenCache
[<Class>]
type TokenCache =
    new (capacity: int) : TokenCache
    member Enabled: bool with get, set
    member Hits: int64
    member Misses: int64
    member Reset () : unit
    member Tokens (language': Language) (line: string) : Token array
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The tokens of the lines of one language, kept by line text. A line that occurs again costs a lookup; when the cache holds capacity lines it starts again empty. ## Constructors
new (capacity: int) : TokenCache
## Properties
member Enabled: bool with get, set
False to tokenize every line asked for.
member Hits: int64
member Misses: int64
## Methods
member Reset () : unit
Empties the cache and its counts.
member Tokens (language': Language) (line: string) : Token array
The tokens of line in language.
--- # Transaction
type Transaction =
    {
        Seq: int64
        Base: int64
        Source: int
        Changes: ChangeSet
        Selection: EditorSelection voption
        StartSelection: EditorSelection voption
        Effects: StateEffect array
        Annotations: Annotation array
        ScrollIntoView: bool
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | One atomic edit, as data. ## Fields
Seq: int64
The transaction's position in its document's log; 0 before it is appended.
Base: int64
The position of the log the transaction was written against.
Source: int
The editor that made the transaction; 0 for a source outside every editor.
Changes: ChangeSet
Selection: EditorSelection voption
The selection of the source after the transaction, in the document it produces.
StartSelection: EditorSelection voption
The selection of the source before the transaction.
Effects: StateEffect array
Annotations: Annotation array
ScrollIntoView: bool
True when the source's view scrolls its main selection into view.
## Functions and values
annotation<'T> (annotationType: AnnotationType<'T>) (transaction: Transaction) : 'T voption
The value of the transaction's annotation of kind annotationType.
asForeign (transaction: Transaction) : Transaction
The transaction as an editor other than its source applies it: the changes and annotations, without the selection, the effects and the scroll request.
isUserEvent (event: string) (transaction: Transaction) : bool
True when the transaction's user event is event or more specific: "input" matches "input.type".
## Properties
member DocChanged: bool
--- # Tx
module Tx
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | The parts a transaction is built from. ## Functions and values
addToHistory (record: bool) : TxSpec
annotate (annotation: Annotation) : TxSpec
change (spec: ChangeSpec) : TxSpec
A replacement, addressing the document before the transaction.
changeSet (changes: ChangeSet) : TxSpec
A change set for the document before the transaction. A transaction takes one, and no other change.
changes (specs: ChangeSpec list) : TxSpec
Replacements, each addressing the document before the transaction.
effect (effect: StateEffect) : TxSpec
group (id: int64) : TxSpec
isolateHistory: TxSpec
scrollIntoView: TxSpec
Scrolls the main selection into view in the view of the editor that dispatches the transaction.
selection (selection: EditorSelection) : TxSpec
The selection after the transaction, addressing the document it produces.
userEvent (event: string) : TxSpec
--- # TxSpec
type TxSpec =
    | ChangeSpecs of ChangeSpec list
    | ChangeSetSpec of ChangeSet
    | SelectionSpec of EditorSelection
    | EffectSpec of StateEffect
    | AnnotationSpec of Annotation
    | ScrollIntoViewSpec
| | | |---|---| | Assembly | `Ranvier.Plume` | A part of a transaction under construction. ## Cases
ChangeSpecs of ChangeSpec list
ChangeSetSpec of ChangeSet
SelectionSpec of EditorSelection
EffectSpec of StateEffect
AnnotationSpec of Annotation
ScrollIntoViewSpec
--- # Update
type Update =
    {
        StartState: EditorState
        State: EditorState
        Transactions: Transaction array
        Changes: ChangeSet
        Effects: StateEffect array
    }
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | What changed in an editor between two reads of an update reader. ## Fields
StartState: EditorState
The state at the reader's read before this one.
State: EditorState
Transactions: Transaction array
The transactions between the two states, as the editor applied them: a transaction of another editor carries its changes and annotations only.
Changes: ChangeSet
The changes of every transaction, composed.
Effects: StateEffect array
The effects of every transaction, in order. An effect's positions address the document its own transaction produces.
## Properties
member DocChanged: bool
member SelectionSet: bool
--- # UpdateReader
[<Class>]
type UpdateReader =
    member Read () : Update
| | | |---|---| | Assembly | `Ranvier.Plume` | | Attributes | `[]` | A reader of an editor's transactions. ## Methods
member Read () : Update
Everything since the reader's last value. A tracked read: an effect that calls it runs again when the editor's state changes, and each transaction reaches it once.