Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

fix(engine): note.edit reads CR as a paragraph return too

moppeeer95a5317b0ba9
diff --git a/ROADMAP.md b/ROADMAP.md
index ff35770da..0c799be78 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -129,8 +129,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
-- **2026-10-11** · `story.replaceRange`, `story.setText`, notes, footnotes, endnotes, type on a path and table cells read ` ` and `
-` as paragraph returns, as `frame.create` and `text.insert` already did. No readiness percentage change.
+- **2026-10-11** · `story.replaceRange`, `story.setText`, notes, footnotes, endnotes, type on a path and table cells read `\r` and `\r\n` as paragraph returns, as `frame.create` and `text.insert` already did. No readiness percentage change.
- **2026-10-10 (UI.4–UI.5):** Panel tabs can move into other groups, split the dock, float, resize and return to their saved locations through shared docking transactions. Layouts persist in custom workspaces; UI and control commands share the same validated action path. Shared pane geometry and widget-state theme application retain all five palettes and local fonts. Split panes send keyboard input only to the focused canvas and scope contextual toolbar IDs per pane. No readiness percentage change.
- **2026-10-10** · Version 0.6.0; releases add a Linux riscv64 tar.gz (cross-compiled, CLI
smoke-tested under QEMU).
diff --git a/crates/engine/src/cmd/editorial.rs b/crates/engine/src/cmd/editorial.rs
index 451c96110..6bb73176b 100644
--- a/crates/engine/src/cmd/editorial.rs
+++ b/crates/engine/src/cmd/editorial.rs
@@ -36,7 +36,7 @@ pub fn specs() -> Vec<CommandSpec> {
}),
cmd!("note.edit", "Edit Note", [], None, "{story, id, text?, author?}", has_doc, |s, p| {
let (sid, id) = target(p)?;
- let (text, author) = (str_param(p, "text").map(str::to_string), str_param(p, "author").map(str::to_string));
+ let (text, author) = (str_param(p, "text").map(|_| super::text_param(p, "text")), str_param(p, "author").map(str::to_string));
s.edit(|d, _| {
let st = d.story_mut(sid).ok_or_else(|| bad("note.edit", "no such story"))?;
let n = st.editorial.iter_mut().find(|n| n.id == id).ok_or_else(|| bad("note.edit", format!("no note {id}")))?;
diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs
index cc9a5fbc7..87358c36f 100644
--- a/crates/engine/src/cmd/object.rs
+++ b/crates/engine/src/cmd/object.rs
@@ -2571,6 +2571,13 @@ mod line_end_tests {
assert_eq!((story(&s).text.as_str(), story(&s).paras.len()), ("Zero\nOne\nTwo\nThree\nFour", 5));
s.execute("story.setText", &json!({"story": sid.0, "text": "A\r\nB\rC"})).unwrap();
assert_eq!((story(&s).text.as_str(), story(&s).paras.len()), ("A\nB\nC", 3));
+ // Notes, made and edited.
+ s.execute("text.select", &json!({"story": sid.0, "anchor": 1})).unwrap();
+ let n = s.execute("note.new", &json!({"text": "One\rTwo"})).unwrap();
+ let note = |s: &mut Session| s.execute("note.list", &json!({})).unwrap()[0]["text"].clone();
+ assert_eq!(note(&mut s), "One\nTwo");
+ s.execute("note.edit", &json!({"story": n["story"], "id": n["id"], "text": "Three\r\nFour"})).unwrap();
+ assert_eq!(note(&mut s), "Three\nFour");
}
}