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

+1 -21
View File
@@ -8,29 +8,9 @@ use thiserror::Error;
use super::complete::{edit_distance, rank};
use super::registry::{self, Choice, CommandId as Id, Spec};
use crate::model::{Border, ColorName, Fold, NodeId, StyleName, Tag, Title};
pub use crate::model::{Layout, Side};
use crate::view::ViewKind;
/// How `:tidy` arranges a branch.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Layout {
/// A mind map, growing to the right.
Map,
/// An org chart, growing down.
Chart,
/// A grid, for idea dumps.
Grid,
}
/// Which edges `:align` lines up.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Side {
Left,
Right,
Top,
Bottom,
Center,
}
/// What `:export` writes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExportFormat {