documents: table moves and tidy read apart; a code press names its text

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 15:16:42 -04:00
1 parent 0558f0c890
commit bcee87c08f
12 files changed
+321 -106

No files matched your search

+9 -2
View File
@@ -61,7 +61,8 @@ pub struct DocumentTarget {
pub link: Option<String>,
pub image: Option<String>,
pub in_table: bool,
pub in_code: bool,
/// The code block's text, pressed in one.
pub code: Option<String>,
}
impl MarkdownDocument {
@@ -115,6 +116,12 @@ impl MarkdownDocument {
};
let kind = block.map(|block| block.kind);
let pressed = block.map(|block| self.drawn(block));
let code = (pointed.code.as_deref().map(str::to_string)).or_else(|| {
match block.and_then(|block| block.nodes.as_deref()) {
Some([Node::Code { text, .. }]) => Some(text.clone()),
_ => None,
}
});
let at = at.or(block.map(|block| block.range.start));
let written = self.commit(cx);
if written.is_some() {
@@ -149,7 +156,7 @@ impl MarkdownDocument {
link: pointed.link,
image: pointed.image,
in_table: pointed.table || kind == Some(TargetBlock::Table),
in_code: pointed.code || kind == Some(TargetBlock::Code),
code,
}));
cx.notify();
}