34 releases (6 breaking)
Uses new Rust 2024
| new 0.7.0 | May 16, 2026 |
|---|---|
| 0.6.2 | May 15, 2026 |
| 0.5.0 | May 6, 2026 |
| 0.3.5 | May 4, 2026 |
| 0.0.19 | Apr 25, 2026 |
#386 in Text editors
3,425 downloads per month
Used in 21 crates
(10 directly)
190KB
3.5K
SLoC
hjkl-buffer
Rope-backed text buffer with cursor, edits, motions, folds, viewport, and search.
Core text storage layer for the hjkl workspace. Provides vim-shaped buffer
semantics — charwise/linewise/blockwise selection, motions matching vim edge
cases (h no-wrap, $ clamp, sticky col on j/k), folds, viewport, and
search. Extracted from
sqeel-buffer with
full git history.
Status
Stable public surface. See docs.rs/hjkl-buffer
for the Buffer API invariants and implementer contract.
Features
ratatui(optional, default off): re-exportsStyleand styled-span helpers wired through ratatui. Pull this in only when consuming from a ratatui frontend; otherwise the buffer is UI-agnostic.
Usage
hjkl-buffer = "0.3"
use hjkl_buffer::{Buffer, Position};
let mut buf = Buffer::from_str("hello\nworld");
assert_eq!(buf.row_count(), 2);
assert_eq!(buf.line(0), Some("hello"));
assert_eq!(buf.cursor(), Position { row: 0, col: 0 });
// Move cursor to second row
buf.set_cursor(Position { row: 1, col: 0 });
assert_eq!(buf.cursor().row, 1);
// Replace all content
buf.replace_all("new content");
assert_eq!(buf.as_string(), "new content");
License
MIT. See LICENSE.
Dependencies
~3–5.5MB
~86K SLoC