Edit: settling an interaction keeps the warning of the preview it applies

With Real-time Drawing off, a command that ends a drag first (Undo, Redo,
Clear History, a plug-in command and the others) applies the drag's
deferred preview, but dropped the warning that preview gave, which
releasing the drag shows in the status bar.

- The applied preview's warning is now kept while a top-level command or
  the tool's actions run. A command's result carries it as
  `previewWarning`, and as `warning` when the command has no warning of
  its own, so the status bar shows it.
- Typing kept as its own step when a tool's drag begins, or when Cmd
  lends the Selection tool, shows the warning in the status bar.
- The Cmd-lend path no longer ignores an error from keeping the typing.

Docs: docs/mcp.md (undo/redo row), docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-11-13 04:36:38 -08:00
parent 1dbdbce91f
commit f918c91c13
9 changed files with 182 additions and 16 deletions
+13 -3
View File
@@ -678,12 +678,22 @@ fn undo_group_end(s: &mut Session, p: &Value) -> Result<Value> {
/// under an interaction that would then preview on, or cancel to, the document from before (#1719).
/// A typing session also ends in the Type tool, whose caret and marked text (IME) must follow the
/// document. A preview that Real-time Drawing off left unapplied is applied first, as the tool's own
/// commit applies it; when it fails, the interaction is canceled.
/// commit applies it; when it fails, the interaction is canceled. The applied preview's warning
/// goes to the running command's result or the tool's status messages, as the tool's own commit
/// reports it ([`Session::note_settled_warning`]).
pub(crate) fn settle_interaction(s: &mut Session) -> Result<()> {
let typing = typing_in_progress(s);
match s.unapplied_interaction_preview().filter(|_| !s.previewing) {
Some((cmd, p)) if s.preview(&cmd, &p).is_err() => s.cancel_interaction()?,
_ => s.commit_interaction()?,
Some((cmd, p)) => match s.preview(&cmd, &p) {
Ok(v) => {
if let Some(w) = v.get("warning").and_then(Value::as_str) {
s.note_settled_warning(w);
}
s.commit_interaction()?
}
Err(_) => s.cancel_interaction()?,
},
None => s.commit_interaction()?,
}
if typing {
s.set_tool_option("endTyping", &Value::Bool(true));