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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! # hjkl-buffer
//!
//! Rope-backed text buffer with vim-shaped semantics: charwise/linewise/
//! blockwise selection, motions matching vim edge cases (no `h` wrap, `$`
//! clamp, sticky col on `j`/`k`), folds, viewport, and search.
//!
//! Extracted from `sqeel-buffer` with full git history.
//!
//! ## Features
//!
//! - `ratatui` (off by default): enables the `render` module with a direct
//! cell-write `ratatui::widgets::Widget` impl for [`Buffer`] via
//! [`BufferView`].
//!
//! ## Pre-1.0 stability
//!
//! Pre-1.0: signatures may shift between patch versions. The invariants
//! documented on each type and function are the load-bearing semantics — they
//! will not silently change without a CHANGELOG entry and a deliberate version
//! bump.
//!
//! ## Why so many invariants?
//!
//! Most of them follow from one rule: **the engine layer treats
//! [`Buffer`] as the source of truth for text content**. Any divergence
//! between cached state (engine-side selections, undo stacks, search matches)
//! and the buffer's `lines()` is a bug. The invariants documented on each type
//! are the contract that lets the engine cache aggressively without risking
//! that divergence.
//!
//! Open issues: <https://github.com/kryptic-sh/hjkl/issues>.
//!
//! ## Testing your `Buffer` use
//!
//! Property tests are encouraged for any non-trivial caller. The crate ships
//! its own test suite; reuse [`Buffer::from_str`] to construct fixtures from
//! inline strings.
//!
//! Things worth proving:
//!
//! - After any sequence of valid edits + their inverses, the buffer returns to
//! its original `lines()`.
//! - For any valid [`Position`] and motion call, the resulting cursor is itself
//! valid.
//! - [`Buffer::dirty_gen`] strictly increases across mutations and stays
//! constant across read-only queries.
pub use Buffer;
pub use ;
pub use Fold;
pub use is_keyword_char;
pub use Position;
pub use ;
pub use ;
pub use Span;
pub use Viewport;
pub use Wrap;