Branch a branch out into a document of its own (stage 9b)

<Space>o (the user's pick), :branchout [file] or the right-click menu
moves the cursor's branch into a new document, next to this one and
named after the branch's title (-2 when that's taken), or at the path
given. Its top node becomes the root, in the middle of the canvas, and
the nodes keep their ids, so the links among them, the small and capital
marks on them and the jump lists still find them.

A portal to the new document takes the branch's place (same spot in the
tree and on the canvas, same branch line) as one undo step, with a new
EditOp::BranchOut; u brings the branch back while the new file stays on
disk, as after :new. Then the pane goes through the portal (the user's
pick), so Ctrl-o comes back and the breadcrumb starts with the document
it came from.

Portals inside the branch move along (the user's pick), their paths made
from the new file's folder, and their documents' backlinks follow. Links
between the branch and the rest can't follow, since links stay inside a
document, and the message counts them. The root and portals themselves
can't branch out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
skkeyeandClaude Opus 5.5 committed 2026-10-02 11:25:57 -04:00
1 parent 3b8f7c0b3c
commit 5888d143fd
19 files changed
+343 -13

No files matched your search

+25 -4
View File
@@ -276,6 +276,26 @@ lines.
`:border`, `:style`, `:tag` and `:fold`, setting every selected node as
one undo step, the way the pickers do.
**Branching out** (settled in part 9b)
- `<Space>o` (the user's pick), `:branchout [file]` or the right-click
menu moves the cursor's branch into a document of its own: next to this
one, named after the branch's title (`-2` when that's taken), or at the
path given. Its top node becomes the root, in the middle of the canvas,
and the nodes keep their ids, so the links among them, the marks on them
(small and capital) and the jump lists still find them.
- A portal to the new document takes the branch's place (the same spot in
the tree and on the canvas, the same branch line), as one undo step: `u`
brings the branch back, and the new file stays on disk, as after `:new`.
The pane then goes to the new document, on its root, as through the
portal (the user's pick): `Ctrl-o` comes back, and the breadcrumb starts
with the document it came from.
- Portals inside the branch move along (the user's pick), still leading
where they did from the new file's folder, and their documents'
backlinks follow. Links between the branch and the rest of the document
can't follow (links stay inside a document): the message counts them.
The root can't branch out (it's the whole document), and neither can a
portal (its document is one of its own already).
**Views, panes and popups** (settled in stage 7)
- The Note view is made of parts: the title, the tags, the body, each link
(out, then in) and each child. `j` and `k` step through them, with a bar
@@ -505,7 +525,7 @@ text).
| **Create and edit** | `o` `O` sibling below / above · `a` child · `i` `A` Enter edit the title · `I` edit from its start · `cc` `S` retype |
| **Operators** | `dd` or `dab` delete branch · `dib` delete children · `x` delete just the node · `yy` `yab` `yib` yank · `p` paste as children · `P` paste as siblings below · `>>` `<<` indent / outdent · `"a`–`"z` and `"+` registers · `.` repeat · `u` `Ctrl-r` undo / redo |
| **Modes** | `v` `V` visual · `M` move · `C` connect · `:` command · Esc back to normal |
| **Leader** `<Space>` | `c` color · `s` style · `B` border · `t` tags · `=` tidy (`m` map, `c` chart, `g` grid) · `p` new portal (`:portal `) · `i` inbox · `b` documents · `v` then `c`/`o`/`n` for canvas / outline / note · `w` which-key on/off · `?` help |
| **Leader** `<Space>` | `c` color · `s` style · `B` border · `t` tags · `=` tidy (`m` map, `c` chart, `g` grid) · `p` new portal (`:portal `) · `o` this branch out, to a document of its own · `i` inbox · `b` documents · `v` then `c`/`o`/`n` for canvas / outline / note · `w` which-key on/off · `?` help |
| **Panes, documents** | `Ctrl-w v` `Ctrl-w s` split · `Ctrl-w hjkl` focus · `Ctrl-w w` the next pane · `Ctrl-w c` close · `Ctrl-w o` only · `Ctrl-w =` even sizes · `gt` `gT` `]b` `[b` next / previous document · `ZZ` close pane (the last one quits) |
| **Outline** | `j` `k` rows · `h` `l` parent / first child · `zb` every body · `M` then `j` `k` (`J` `K`: 5) swap with siblings, `h` out, `l` under the one above |
| **Note view** | `j` `k` parts · Enter `i` `A` edit the part (`I` from its start, `cc` `S` anew), or go to that link or child · `h` `l` the sibling before / after |
@@ -709,13 +729,14 @@ cumulus/
"+), yank (nodes into registers and back), visual (selections), repeat (`.`),
search (`/`), jumps (each pane's jump list), marks (capital marks, `:marks`),
connect (connect mode), portals (what portals show, going through them,
`:portal`, backlinks, renames), panes (the split tree), popup (help, menu,
pickers, card, questions)
`:portal`, backlinks, renames), branch_out (`:branchout`), panes (the split
tree), popup (help, menu, pickers, card, questions)
```
The end-to-end tests are in `app/tests.rs` (with `app/tests/files.rs`,
`app/tests/config.rs`, `app/tests/vim.rs`, `app/tests/connect.rs`,
`app/tests/portals.rs` and `app/tests/arrange.rs`): they copy the sample
`app/tests/portals.rs`, `app/tests/arrange.rs` and `app/tests/branch_out.rs`):
they copy the sample
documents to a temporary folder, type keys and click on a test terminal, and
check the screen, the documents and the files.