canvist_core 0.2.1

Platform-agnostic editing engine for canvist: editor state, commands, selection motion, keymaps, input rules, and history
Documentation

canvist_core

The platform-agnostic editing engine behind canvist, built on canvist_model. It has no UI: hosts send it input and draw what it returns.

Most apps add it through canvist, the crate to install, as canvist::core: cargo add canvist.

  • One state: the document, selection, stored marks, and IME composition change through one path, so they never disagree.
  • Commands: typing, deleting by grapheme, word, or line, Enter and Backspace that understand lists and quotes, marks, block types, and copy and paste.
  • Selection motion: by grapheme and word (UAX #29), line, and document. The layout engine answers line and vertical moves.
  • Extensions: history, keymaps (Mod is Cmd on Apple platforms and Ctrl elsewhere), input rules such as ## to a heading, and paste rules, so an app pays only for what it registers.
  • Typed handles: registering an extension returns the only typed way to reach its commands and queries. can() dry runs and all-or-nothing chain()s change nothing unless they apply.

Dynamic hosts call commands by name with checked arguments, and Editor::metadata_json describes every command for generated bindings. The StarterKit extensions are in canvist_extensions.