documents: presses read back through quotes, code, HTML and front matter
Each drawn character finds its written one, skipping only white space, escapes and quote marks, so a press lands on the character itself. Code, front matter and link definitions read back line for line. An HTML block keeps each text run's source byte, and an alert keeps its text past the marker; alert() now takes the source. A secondary press refuses a target its write-back changed, and its focus no longer opens an empty document. Run's element stack moves to tree/stack.rs and the HTML-block reader to tree/html_block.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5af11fe489
commit
83d747d87e
16 files changed
+868
-480
No files matched your search
@@ -24,7 +24,7 @@ use crate::{
|
||||
mod blocks;
|
||||
mod point;
|
||||
|
||||
pub(crate) use point::{OnPoint, Place, Pointed};
|
||||
pub(crate) use point::{OnPoint, Place, Pointed, point_lines};
|
||||
|
||||
pub(crate) type OnLink = Rc<dyn Fn(&str, &mut Window, &mut App)>;
|
||||
/// Reveals the heading whose source starts at a byte.
|
||||
@@ -264,7 +264,7 @@ impl Draw<'_> {
|
||||
} => {
|
||||
if language.as_deref() == Some("mermaid") {
|
||||
let diagram = Diagram::new(self.key("diagram"), text.clone());
|
||||
return self.point_code(diagram.into_any_element(), None, None);
|
||||
return self.point_code(diagram.into_any_element(), None, *from);
|
||||
}
|
||||
if let Some(draw) = self.code {
|
||||
return draw(
|
||||
@@ -299,7 +299,7 @@ impl Draw<'_> {
|
||||
}))
|
||||
.child(code)
|
||||
.into_any_element();
|
||||
self.point_code(block, Some(layout), *from)
|
||||
self.point_code(block, Some((layout, text)), *from)
|
||||
}
|
||||
Node::List { start, items } => self.list(start, items, cx),
|
||||
Node::Table { aligns, head, rows } => {
|
||||
@@ -410,7 +410,7 @@ impl Draw<'_> {
|
||||
.into_any_element(),
|
||||
Node::Alert { kind, body } => self.alert(*kind, body, cx),
|
||||
Node::Toc(headings) => self.toc(headings, cx),
|
||||
Node::FrontMatter(text) => self.front_matter(text, cx),
|
||||
Node::FrontMatter { text, from } => self.front_matter(text, *from, cx),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user