The canvas example did everything itself; now it runs the way the app will. The key engine turns keys into commands, the focused view answers with actions, and the commands every view shares (undo, marks, adding, deleting, folds, tree moves, modes) answer the rest. A view can still give a key its own meaning, since it gets the first say. `:` lines become actions the same way (app::calls). - View trait: kind, contexts (its key tables), layout, render, command and mouse. layout comes before render because a view keeps the frame it drew, to match clicks against, and follows the cursor with its camera; drawing changes nothing. CanvasView owns the camera, the last scene and the mouse drag; it reads the rest from a ViewContext. - Edits travel as data (EditOp), so views never touch the document. Buffer::apply is the one place a document changes: the edit, its undo step, where the cursor goes, marks and `''`. - Mode holds each mode's own state: move mode carries its Grab (whole branch or not), the command line lives in Mode::Command. - Undo groups: a whole move-mode session or mouse drag is one undo step, built up as it goes. After an undo the cursor lands on a node the change added or removed, before the others it touched. - Actions run in order, and a problem stops the rest. Small improvements on the way: zz centers the middle of the node, :find says which match it's on, :unlink with no links says so, folding a node without children says why nothing happened, and a captured idea is placed next to a new Inbox even on the first :in. The example has end-to-end tests now: they type key sequences and mouse gestures into it on a test terminal, and `cargo test` runs them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.6 KiB
2.6 KiB
cumulus
Brainstorm in the terminal: ideas as nodes on a 2D canvas, connected, folded and color-coded, across as many documents as you like. Vim keys first; the mouse works too. Runs on Windows and Linux.
Status: being built, one stage at a time. See DESIGN.md for the plan; this README grows with the app.
Build and run
You need Rust (rustup.rs). The exact version is pinned in
rust-toolchain.toml, and rustup installs it by itself the first time.
cargo build --release
The program is target/release/cumulus (cumulus.exe on Windows): copy it to
a folder on your PATH.
- Windows: nothing else to install. The
.execarries its own C runtime and runs on any Windows 10 or 11. - Linux (Void, Fedora…): build the same way. You can also build a static
Linux binary from Windows with
cargo linux: it lands intarget/x86_64-unknown-linux-musl/release/cumulusand runs on any distribution.
Keys
The plan for the everyday keys (all of them are in DESIGN.md):
| Keys | What they do |
|---|---|
hjkl |
move to the nearest node that way |
gh gj gk gl |
parent, next sibling, previous sibling, first child |
o O a |
new sibling below / above, new child |
i or Enter |
edit the title |
dd x |
delete the branch / just the node |
u Ctrl-r |
undo / redo |
za zf zi |
fold, auto-fold, focus |
+ - |
zoom in / out |
C M v |
connect, move, select |
<Space> |
the action menu |
: ? |
command line, help |
After the first key of a sequence (g, z, d, <Space>…), a popup lists
what can follow.
Development
cargo test # run the tests
cargo lint # clippy, treating warnings as errors
cargo fmt # format the code
While the app is being built, the examples try out each part:
cargo run --example canvas # the canvas, vim keys, which-key, :commands
cargo test show_canvas -- --ignored --nocapture # print it at each zoom, as text
cargo test --example canvas # type key sequences into it, and check what they do