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 bookmarks::Bookmarks;pub use buffer::Buffer;pub use buffer::BufferId;pub use buffer::CommentSyntax;pub use buffer::FileMeta;pub use buffer::Indent;pub use buffer::LineEdit;pub use buffer::LineEnding;pub use changeset::Bias;pub use changeset::ChangeSet;pub use changeset::Edit;pub use column_edit::ColumnInsert;pub use column_edit::Leading;pub use column_edit::NumberFormat;pub use column_edit::NumberSequence;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::SavedHistory;pub use history::Transaction;pub use history::sha256_hex;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 text_tools::Codec;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.- bookmarks
- Bookmarks: marked lines, as in Notepad++ (Search > Bookmark). They belong to the document, so every view of it shows the same ones, and changing them is not an undo step. They follow edits the way Scintilla’s line markers do: text inserted at the start of a marked line pushes the mark down with the line’s text, a mark whose line break before it is deleted joins the line before, and the marks in a block of replaced lines stay on the same lines as far as the new text reaches (sorting lines keeps marks where they were).
- brackets
- Matching brackets:
(),[]and{}. Plain text: a bracket inside a string or comment counts like any other. The search is bounded so a caret next to an unmatched bracket in a huge file stays cheap. - buffer
Buffer: one document’s text, undo history, revisions and file metadata.- changeset
ChangeSet: concrete, non-overlapping edits against one document state.- column_
edit - The Column Editor (Notepad++’s Edit > Column Editor, Alt+C): the same text, or a sequence of numbers, inserted at one column on many lines.
- 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::applyis the only path that mutates a document (PLAN 3.5).- filter
- The filter view’s lines (PLAN_v0.3.0 P6): which lines a pattern shows.
The hiding itself is in
crate::fold::FoldSet, set throughcrate::Editor::set_filter. - 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, and the history kept between sessions (SavedHistory, PLAN_v0.3.0 3.3). - indent
- Indentation: detecting how a file is indented, and converting its leading whitespace between tabs and spaces.
- 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.
- tags
- Matching tags in HTML and XML: the names in the start and end tag of the
element at a caret, which the editor outlines as Notepad++ does. Plain
text, like
brackets: tags are found by scanning the text, not from the syntax highlighting, and only withinSEARCH_LIMITbytes either way of the caret, so a caret in a huge file stays cheap. The window’s start is taken to be outside any comment, quoted value or script. - text
Document: the rope, addressed only byByteOffset.- text_
tools - Text tools (PLAN_v0.3.0 P4): JSON format, minify and validate with our own tokenizer, Base64 and URL (percent) encoding, and MD5, SHA-1 and SHA-256 hashes.
- transform
- Text transforms: case conversion, line sorting, and line operations (trim, duplicate, move, join, delete, transpose, insert, reverse, remove empty or duplicate lines) and blank operations (trim, EOL to space, tabs and spaces). Each resolves to one transaction.
- view
View: a window onto a buffer with its own selections and scroll position.
Functions§
- word_at
- The run of same-class graphemes around
p, preferring a word on either side. Never crosses a newline. The word (or run of punctuation, or of blanks) atp, as a double-click selects it; empty between two line breaks.