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]>
45 lines
1.5 KiB
TOML
45 lines
1.5 KiB
TOML
[package]
|
|
name = "cumulus"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
# The version cumulus is built and tested with (pinned in rust-toolchain.toml).
|
|
rust-version = "1.90"
|
|
description = "Brainstorm in the terminal: idea graphs on a 2D canvas, with vim keys and the mouse."
|
|
publish = false
|
|
|
|
[dependencies]
|
|
# Document files are RON (Rust Object Notation), read and written through serde.
|
|
serde = { version = "1", features = ["derive"] }
|
|
ron = "0.12"
|
|
# Config files are TOML: keys.toml so far, config.toml and themes later.
|
|
toml = "1"
|
|
# Error types with readable messages, for the parts that report problems.
|
|
thiserror = "2"
|
|
# Terminal user interface. The crossterm backend works on Windows, Linux and
|
|
# macOS. Default features are off to skip widgets cumulus doesn't use.
|
|
ratatui = { version = "0.30", default-features = false, features = ["crossterm_0_29", "layout-cache"] }
|
|
# How many terminal columns text takes (accents, Asian scripts, emoji), for
|
|
# sizing node boxes.
|
|
unicode-width = "0.2"
|
|
# Where one character ends and the next begins, so the cursor steps over an
|
|
# accented letter or an emoji in one go.
|
|
unicode-segmentation = "1"
|
|
|
|
[lints.rust]
|
|
unsafe_code = "forbid"
|
|
|
|
[lints.clippy]
|
|
all = { level = "warn", priority = -1 }
|
|
|
|
[profile.release]
|
|
# A smaller, faster program: optimize across all crates at once (lto, in one
|
|
# piece with codegen-units = 1), and leave out the debug symbols (strip).
|
|
lto = true
|
|
codegen-units = 1
|
|
strip = true
|
|
|
|
# The canvas example is the build's checkpoint: `cargo test` runs its tests too.
|
|
[[example]]
|
|
name = "canvas"
|
|
test = true
|