Tidy a branch and line nodes up (stage 9a)

The first small part of stage 9 (v1.1). <Space>= then m, c or g (the
user's pick: leader menus), or :tidy map|chart|grid, lays out the
cursor's branch while its top node stays put: a mind map puts each node
in the middle of its children (the user's pick), an org chart puts them
side by side below, and a grid makes a block of cards beside the node
(the user's pick), a card's own branch going along as a mind map. Every
node of the branch gets a place, folded away or not (the user's pick),
as one undo step, and the message says when the branch now covers nodes
outside it.

The lines follow the layouts: a parent whose children are all below it
sends its branches down to a shared bend, and a new child of it goes
beside the last one; a grid card behind another isn't joined by a line,
which would look like it joins the two cards.

In visual mode, <Space>a then h, l, k, j or c lines the selection up on
the box around it, each node bringing its branch along, and : opens the
command line on the selection: :align and :tidy take it, and so do
:color, :border, :style, :tag and :fold, as one undo step. The layouts
are pure functions in view::canvas::arrange, applied as one
EditOp::Reposition. Layout and Side moved from the parser to the model
so keys can name them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
skkeyeandClaude Opus 5.5 committed 2026-10-02 10:42:00 -04:00
1 parent 95c6c3ca37
commit 13a603837e
25 files changed
+709 -65

No files matched your search

+17
View File
@@ -7,6 +7,8 @@
//! [`COMMANDS`] names every command, for `keys.toml`, and says what it does,
//! for which-key and the help.
use crate::model::{Layout, Side};
/// Ways to move the cursor.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Motion {
@@ -295,6 +297,12 @@ pub enum Command {
/// `Ctrl-u`.
DeleteLineBefore,
// Arranging.
/// Lay the cursor's branch out (or each selected one).
Tidy(Layout),
/// Line the selected nodes up.
Align(Side),
// Looks, tags, portals.
PickColor,
PickStyle,
@@ -497,6 +505,15 @@ pub const COMMANDS: &[CommandInfo] = &[
info("delete-after", C::DeleteAfter, "delete the character after the cursor"),
info("delete-word-before", C::DeleteWordBefore, "delete the word before the cursor"),
info("delete-line-before", C::DeleteLineBefore, "delete back to the start of the line"),
// Arranging.
info("tidy-map", C::Tidy(Layout::Map), "tidy: a mind map"),
info("tidy-chart", C::Tidy(Layout::Chart), "tidy: an org chart"),
info("tidy-grid", C::Tidy(Layout::Grid), "tidy: a grid beside it"),
info("align-left", C::Align(Side::Left), "left edges in a line"),
info("align-right", C::Align(Side::Right), "right edges in a line"),
info("align-top", C::Align(Side::Top), "top edges in a line"),
info("align-bottom", C::Align(Side::Bottom), "bottom edges in a line"),
info("align-center", C::Align(Side::Center), "middles in a column"),
// Looks, tags, portals.
info("pick-color", C::PickColor, "color…"),
info("pick-style", C::PickStyle, "style…"),