documents: block commands reread their result

Fixes R4.7 round 2: a heading change or split is parsed again and
refused as Misread when its text, formats or kind would change;
closing hashes and block openers are escaped at split ends; task
boxes below a marker stay; indented code is written from its value;
alerts unwrap past blank and lazy lines; delete counts every gone
opener.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 14:36:49 -04:00
1 parent b37031b00b
commit 892e095025
12 files changed
+435 -90

No files matched your search

+3 -3
View File
@@ -9,7 +9,7 @@ use crate::documents::{
};
/// `marked` after `command`: `‸` is the caret, `⟨…⟩` the selection.
fn ran(marked: &str, command: BlockCommand) -> Result<String, EditRefusal> {
pub(super) fn ran(marked: &str, command: BlockCommand) -> Result<String, EditRefusal> {
let caret = marked.find('‸');
let text: String = marked.chars().filter(|ch| !"‸⟨⟩".contains(*ch)).collect();
let selection = match caret {
@@ -35,12 +35,12 @@ fn ran(marked: &str, command: BlockCommand) -> Result<String, EditRefusal> {
})
}
fn ok(marked: &str, command: BlockCommand) -> String {
pub(super) fn ok(marked: &str, command: BlockCommand) -> String {
ran(marked, command).expect("ran")
}
/// The top-level blocks `text` reads as.
fn kinds(text: &str) -> Vec<&'static str> {
pub(super) fn kinds(text: &str) -> Vec<&'static str> {
let text: String = text.chars().filter(|ch| !"‸⟨⟩".contains(*ch)).collect();
let root = file_tree(&text);
let kids = root.children().map(Vec::as_slice).unwrap_or_default();