mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
M5: a Replace text comment is named Replace text, not Strikethrough (#3947)
The Replace text tool saves a StrikeOut with /IT /StrikeOutTextEdit and a caret reply. The Comments panel named it by subtype only, and tool_for mapped it to the Strikethrough tool, so Make Current Properties Default on it changed the Strikethrough tool's defaults. Both now read the intent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3niW7kVeT8mi7TpWc8eAJ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
606c560d24
commit
6411cc803f
@@ -347,6 +347,7 @@ pub fn tool_for(a: &Annotation) -> Option<CommentTool> {
|
||||
("FreeText", _) => CommentTool::TextBox,
|
||||
("Highlight", _) => CommentTool::Highlight,
|
||||
("Underline", _) => CommentTool::Underline,
|
||||
("StrikeOut", Some("StrikeOutTextEdit")) => CommentTool::ReplaceText,
|
||||
("StrikeOut", _) => CommentTool::StrikeOut,
|
||||
("Squiggly", _) => CommentTool::Squiggly,
|
||||
("Ink", _) => CommentTool::Ink,
|
||||
|
||||
@@ -33,9 +33,10 @@ pub fn subtype_label(s: &str) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
/// The comment type as the panel names it, telling callouts and clouds apart by `/IT`.
|
||||
/// The comment type as the panel names it, telling callouts, clouds and replaced text apart by `/IT`.
|
||||
pub fn kind_label(a: &Annotation) -> &str {
|
||||
match a.intent.as_deref() {
|
||||
Some("StrikeOutTextEdit") => "Replace text",
|
||||
Some("FreeTextCallout") => "Callout",
|
||||
Some("PolygonCloud") => "Cloud",
|
||||
Some("FreeTextTypeWriter") => "Typewriter",
|
||||
|
||||
@@ -1231,6 +1231,13 @@ fn replacing_text_strikes_it_and_adds_a_caret() {
|
||||
assert_eq!(caret.in_reply_to, strike.name, "grouped with the strikeout");
|
||||
assert_eq!(h.state().session.get(h.state().views[0].id).unwrap().can_undo(), Some("Replace text"));
|
||||
assert_eq!(h.state().quick_tool, QuickTool::Select);
|
||||
// The strikeout is the Replace text tool's, not Strikethrough's (#3947): the panel names it
|
||||
// so, and Make Current Properties Default updates the Replace text tool.
|
||||
assert_eq!(pdfcraft_ui_egui::comments::tool_for(strike), Some(pdfcraft_ui_egui::comments::CommentTool::ReplaceText));
|
||||
h.state_mut().set_option("panel", "comments").unwrap();
|
||||
h.run_steps(3);
|
||||
assert!(h.query_by_role_and_label(egui::accesskit::Role::Label, "Replace text").is_some(), "the panel names the comment Replace text");
|
||||
assert!(h.query_by_role_and_label(egui::accesskit::Role::Label, "Strikethrough").is_none(), "not Strikethrough");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user