Skip to main content

Crate ochrepad_core

Crate ochrepad_core 

Source
Expand description

Headless editing core: text, positions, selections, actions, transactions and undo. No egui and no filesystem access (PLAN 3.1, 7).

Re-exports§

pub use action::Action;
pub use action::ActionError;
pub use action::Direction;
pub use action::Motion;
pub use buffer::Buffer;
pub use buffer::BufferId;
pub use buffer::FileMeta;
pub use buffer::LineEdit;
pub use buffer::LineEnding;
pub use changeset::Bias;
pub use changeset::ChangeSet;
pub use changeset::Edit;
pub use display::DisplayMap;
pub use display::Padding;
pub use display::RowPos;
pub use editor::Clock;
pub use editor::Editor;
pub use editor::ManualClock;
pub use editor::Settings;
pub use editor::SystemClock;
pub use fold::FoldSet;
pub use fold::FoldStrategy;
pub use history::EditKind;
pub use history::Transaction;
pub use macros::MacroError;
pub use macros::NamedMacro;
pub use macros::Repeat;
pub use position::ByteOffset;
pub use position::CharIdx;
pub use position::LineCol;
pub use position::VisualCol;
pub use search::SearchError;
pub use search::SearchOptions;
pub use search::SearchQuery;
pub use search::Searcher;
pub use selection::Rectangle;
pub use selection::Selection;
pub use selection::SelectionSet;
pub use text::Document;
pub use transform::CaseMode;
pub use transform::SortOptions;
pub use view::View;
pub use view::ViewId;

Modules§

action
Action: what the user intends, independent of where the carets are (PLAN 3.5). Key bindings map to actions and macros record them.
buffer
Buffer: one document’s text, undo history, revisions and file metadata.
changeset
ChangeSet: concrete, non-overlapping edits against one document state.
diff
Line and word diff for the compare view (PLAN M12), using similar.
display
Display rows: how a view’s document lines map to rows on screen (PLAN_v0.2.0 3.2). A row is addressed relative to its line, as a RowPos, so nothing needs a global row index: with word wrap that would mean wrapping the whole file. Lines hidden by a fold have no rows; with word wrap on, a line has one row per wrapped piece, otherwise one.
editor
Editor: owns buffers and views. Editor::apply is the only path that mutates a document (PLAN 3.5).
fold
Code folding (PLAN_v0.2.0 N3): where regions are, and which are folded in a view.
history
Undo/redo over Transactions, with coalescing of consecutive typing.
macros
Macro playback. Recording happens in Editor::apply: while recording, every successful recordable action is appended.
position
Position newtypes and the conversions between them.
search
Find and replace over the document without copying it into a String.
selection
Selections are always a set (PLAN 3.3). A plain cursor is a set of one empty selection.
text
Document: the rope, addressed only by ByteOffset.
transform
Text transforms: case conversion, line sorting, and line operations (trim, duplicate, move, join, remove empty or duplicate lines). Each resolves to one transaction.
view
View: a window onto a buffer with its own selections and scroll position.