1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Multiline text-editor building blocks.
//!
//! [`EditorModel`] is the pure editing model — document lines, a char-index
//! [`Pos`] cursor, anchor-based selection, and snapshot undo/redo. The
//! [`Editor`] entity renders it with a line-number gutter, syntax
//! highlighting (see [`Language`]/[`Highlighter`]), selection, and the full
//! keyboard map, emitting [`EditorEvent`] as the buffer changes.
//!
//! ```ignore
//! use guise::editor::{Editor, EditorEvent, Language};
//!
//! let editor = cx.new(|cx| {
//! Editor::new(cx)
//! .language(Language::Rust)
//! .value("fn main() {}")
//! });
//! cx.subscribe(&editor, |_this, _editor, event: &EditorEvent, _cx| {
//! if let EditorEvent::Run(source) = event { /* Cmd+Enter */ }
//! })
//! .detach();
//! ```
// The `Editor` entity lives in its own file, named for the component like
// every other module; the path doubling (`editor::editor`) never leaks since
// the type is re-exported here.
// Compiled for tests even without the feature, so `cargo test` exercises the
// adapter against the dev-dependency grammar.
pub use HighlightCache;
pub use ;
pub use ;
pub use ;
pub use ;
pub use TreeSitterHighlighter;