Skip to main content

escriba_core/
lib.rs

1//! `escriba-core` — foundational types.
2//!
3//! No I/O. No rendering. No tatara-lisp. Just the typed vocabulary every
4//! other escriba crate speaks:
5//!
6//!   - [`Position`] — line + column, 0-indexed, UTF-8 char offsets.
7//!   - [`Range`] — half-open `[start, end)`.
8//!   - [`Cursor`] — anchor + head (for selection growth).
9//!   - [`Selection`] — multi-cursor ordered set.
10//!   - [`Mode`] — the vim-ish modal state.
11//!   - [`Motion`] / [`Operator`] — compose into commands.
12//!   - [`Edit`] — primitive mutation.
13//!   - [`Action`] — top-level dispatched-to-buffer command.
14//!   - [`BufferId`] / [`WindowId`] — opaque identifiers.
15//!
16//! Every type derives `schemars::JsonSchema` so escriba-api can emit an
17//! OpenAPI spec over the full domain surface — the editor's entire public
18//! shape is spec-first by construction.
19
20extern crate self as escriba_core;
21
22pub mod action;
23pub mod damage;
24pub mod edit;
25pub mod filetype;
26pub mod r#gen;
27pub mod id;
28pub mod jumplist;
29pub mod mode;
30pub mod motion;
31pub mod position;
32pub mod range;
33pub mod selection;
34
35pub use action::{Action, CountedAction, HighlightEffect, TextEffect};
36// `Action::SearchOpen` carries it, so anything that CONSTRUCTS an action needs
37// it. Re-exported here rather than making every such crate take a direct
38// escriba-search dependency for one enum.
39pub use damage::{Damage, LineDelta};
40pub use edit::{Edit, EditKind};
41pub use escriba_search::Direction as SearchDirection;
42pub use filetype::{CommentString, Filetype, FiletypeTable};
43pub use r#gen::EditGen;
44pub use id::{BufferId, CaretId, WindowId};
45pub use jumplist::{JUMPLIST_LIMIT, JumpList};
46// memori lives in its own leaf crate so `escriba-search` — which sits BELOW
47// core in the dependency graph — can use it too. Re-exported here so position
48// code in core and above reads naturally without naming a second crate.
49pub use escriba_memori::{Anchored, Bound, Bytes, Chars, Offset, Ruler, Scale, Utf16Units};
50pub use mode::{CursorShape, Mode, ModeTransition};
51pub use motion::{Motion, Operator, TextObject};
52pub use position::Position;
53pub use range::Range;
54pub use selection::{Cursor, Cursors, Selection};