Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WordCraft roadmap

> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-11-21 · **Change:** trivial (table rows split across pages: a cell's first paragraph on the page can split even when only one line fits, if the row starts at the top, with or without its own headers, or continues from the previous page (#6823)); previously trivial (release wrap areas when strict column balancing moves the anchor line, #6821); previously trivial (balanced columns keep lines together from Word 2013's layout, #6821); previously trivial (progress log: TIFF picture chooser, drop and pasted-path routing, #6704); previously minor (added layout.fitOnePage and its Layout › Page Setup ribbon button to condense a multi-page document by one page while preserving typography hierarchy); previously minor (#3398: persistent screen paper colors; parity estimates unchanged); previously minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged)
> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-11-22 · **Change:** trivial (progress log: a panic in the checks or hooks around a command is an error, #3721); previously trivial (table rows split across pages: a cell's first paragraph on the page can split even when only one line fits, if the row starts at the top, with or without its own headers, or continues from the previous page (#6823)); previously trivial (release wrap areas when strict column balancing moves the anchor line, #6821); previously trivial (balanced columns keep lines together from Word 2013's layout, #6821); previously trivial (progress log: TIFF picture chooser, drop and pasted-path routing, #6704); previously minor (added layout.fitOnePage and its Layout › Page Setup ribbon button to condense a multi-page document by one page while preserving typography hierarchy); previously minor (#3398: persistent screen paper colors; parity estimates unchanged); previously minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged)
> **CLI path update:** 2026-11-04 · Options before a non-Unicode input filename no longer make the CLI reject that filename; text option values still require Unicode; `run --file` and `run --script` retain native paths. No ranked gap or readiness estimate changes.
> **Floating anchor row segments:** 2026-11-07 · A floating anchor after a manual page/column break counts visible content on the far side of the same wrapped row. Marker-only cover anchors retain their previous-page rule. Synthetic picture spacing, placement and history controls; no new native Word measurement. Readiness estimates unchanged.

Expand Down Expand Up @@ -151,6 +151,7 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm

## Progress log

- 2026-11-22: Never crash: a panic in the checks and hooks `Session::run` runs after a command (protected-region check, formatting revisions, connector reroute, outline, typing bookkeeping) is now an error that restores the document, selection and undo history, like a panic in the command itself; a panic in a command's `enabled` or protection pre-check is an error instead of escaping; and a panic while a command that opens or switches documents (New, Open) settles in its new document closes that document and goes back to the one it started from. This holds where panics unwind (desktop); the web build aborts on any panic, as before. (#3721)
- 2026-11-21: Layout: strict column balancing measures a kept paragraph again in each candidate column, so a float in one column does not make the paragraph skip another where it fits (#6821). Readiness estimates unchanged.

- 2026-11-20: `wordcraft-cli mcp` starts only with both `--automation-read-root` and `--automation-write-root` (shared rule 18, #7124); without them it stops with an error naming the two flags, where it used to serve with access to every file the user can reach. `mcp --connect` is refused until the desktop app confines its control channel to the same roots (#3695, #5819). The help, `docs/mcp.md`, the README and `AGENTS.md` pass both roots in every example.
Expand Down Expand Up @@ -961,6 +962,7 @@ MATH glyphs that reference the same construction now share its immutable variant
| 2026-10-30 | trivial | the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key |
| 2026-11-18 | trivial | Progress log: border boxes close their corners |
| 2026-10-30 | trivial | Progress log: under Track Changes a list item deleted whole shows its number as deleted text, in the deletion's colour and mark (#4828); readiness unchanged |
| 2026-11-22 | trivial | Progress log: the panic guard in `Session::run` covers the after-command hooks, the pre-checks and settling in another document (#3721) |
| 2026-11-10 | trivial | Save As on Linux: the desktop portal's Save dialog reports the file type picked, updating the extension so saving as PDF writes a .pdf (#6180) |
| 2026-11-08 | trivial | Progress log: freestanding custom.dic dictionary file support in File › Options › Proofing (#5840) |
| 2026-11-04 | trivial | Progress log: #4501 refactor regressions restored (#4683) |
Expand Down
32 changes: 32 additions & 0 deletions crates/engine/src/cmd/md_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,38 @@ mod tests {
assert!(s.can_redo());
}

/// Leaving with edits the document doesn't have yet applies them and drops the text; when a
/// hook after the toggle panics, the view stays open with the edits (#3721).
#[test]
fn a_failed_leave_keeps_the_edited_text() {
let mut s = session(SAMPLE);
let before = s.doc.clone();
s.run(TOGGLE, &json!({})).unwrap();
let text = s.run(TEXT, &json!({})).unwrap()["text"].as_str().unwrap().replace("First paragraph.", "Changed paragraph.");
set_text(&mut s, &text);
crate::session::PANIC_AFTER_COMMAND.with(|f| f.set(true));
assert!(s.run(TOGGLE, &json!({})).is_err());
assert_eq!(s.md_source.as_ref().map(|src| src.text.as_str()), Some(text.as_str()), "the edits are kept");
assert!(s.doc.same_content(&before));
s.run(TOGGLE, &json!({})).unwrap();
assert!(body_text(&s).contains("Changed paragraph."));
}

/// A text edit whose after-command hook panics leaves the text, and the unsaved-changes
/// flag, as they were (#3721).
#[test]
fn a_failed_text_edit_keeps_the_text_as_it_was() {
let mut s = session(SAMPLE);
s.run(TOGGLE, &json!({})).unwrap();
let text = s.run(TEXT, &json!({})).unwrap()["text"].as_str().unwrap().to_string();
crate::session::PANIC_AFTER_COMMAND.with(|f| f.set(true));
assert!(s.run(TEXT, &json!({"text": text.replace("First paragraph.", "Lost paragraph.")})).is_err());
assert_eq!(s.md_source.as_ref().map(|src| src.text.as_str()), Some(text.as_str()));
assert!(!s.dirty);
s.run(TOGGLE, &json!({})).unwrap();
assert!(!body_text(&s).contains("Lost paragraph."));
}

static TEST_DIR_COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);

/// Generates a unique temporary directory for test file isolation.
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ mod lifecycle;
mod query;
mod run;
mod snapshot;
#[cfg(test)]
pub(crate) use run::{PANIC_AFTER_COMMAND, PANIC_SETTLING_ELSEWHERE, PANICS_CAUGHT};

use crate::doc_state;
use crate::ime as ime_state;
Expand Down
Loading
Loading