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//! - [`Register`] — captured text plus the [`RegisterKind`] a put replays it as.
14//! - [`Action`] — top-level dispatched-to-buffer command.
15//! - [`BufferId`] / [`WindowId`] — opaque identifiers.
16//!
17//! Every type derives `schemars::JsonSchema` so escriba-api can emit an
18//! OpenAPI spec over the full domain surface — the editor's entire public
19//! shape is spec-first by construction.
20
21extern crate self as escriba_core;
22
23pub mod action;
24pub mod damage;
25pub mod edit;
26pub mod filetype;
27pub mod r#gen;
28pub mod id;
29pub mod jumplist;
30pub mod mode;
31pub mod motion;
32pub mod position;
33pub mod range;
34pub mod register;
35pub mod selection;
36
37pub use action::{Action, CountedAction, HighlightEffect, InsertAt, TextEffect, ViewAlign};
38// `Action::SearchOpen` carries it, so anything that CONSTRUCTS an action needs
39// it. Re-exported here rather than making every such crate take a direct
40// escriba-search dependency for one enum.
41pub use damage::{Damage, LineDelta};
42pub use edit::{Edit, EditKind};
43pub use escriba_search::Direction as SearchDirection;
44pub use filetype::{CommentString, Filetype, FiletypeTable};
45pub use r#gen::EditGen;
46pub use id::{BufferId, CaretId, WindowId};
47pub use jumplist::{JUMPLIST_LIMIT, JumpList, Spot};
48// memori lives in its own leaf crate so `escriba-search` — which sits BELOW
49// core in the dependency graph — can use it too. Re-exported here so position
50// code in core and above reads naturally without naming a second crate.
51pub use escriba_memori::{Anchored, Bound, Bytes, Chars, Offset, Ruler, Scale, Utf16Units};
52pub use mode::{CursorShape, Mode, ModeTransition};
53pub use motion::{Motion, Operator, TextObject};
54pub use position::Position;
55pub use range::Range;
56pub use register::{Register, RegisterKind};
57pub use selection::{Cursor, Cursors, Selection};