Skip to main content

Module editor

Module editor 

Source
Expand description

Editor integration (PLAN.md §12): materialize the cached blob to a real file, suspend the terminal, spawn the editor read-only, resume with a full redraw — the one legitimate terminal.clear().

Structs§

EditorJob
A prepared editor invocation, ready for the main loop to run while the terminal is suspended.

Functions§

build_args
Read-only args for the vim family; helix & co. have no such flag — they edit the materialized cache copy, which is harmless (rootle never writes back; PLAN.md §12 read-only decision).
materialize
Write the blob bytes to ~/.cache/rootle/edit/<owner>/<repo>/<sha>.<ext> — content-addressed like the rest of the cache, so the same path in two branches/repos never collides and the editor still gets a real extension for syntax detection. Traversal-safe: the sha must be hex (network bytes never reach a path component).
prepare
Prepare an editor job: resolve the editor, get the bytes (cache-first; blocking is fine — the UI is about to suspend), and materialize the file.
resolve_program
Resolution order: [editor].program → $VISUAL → $EDITOR → probe hx, nvim, vim, vi on PATH.