mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
M5: keep the pop-up raster rule in a helper after merging main (clippy cognitive complexity)
Main's signature-state redraw in apply_edit pushed the function over the cognitive-complexity limit with the pop-up exception inline; the rule moves into one_page_changed unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyCHD1R3rywQBPCHXZA
This commit is contained in:
1 parent
ecbba16780
commit
abb29ba7e1
1 file changed
+10
-6
@@ -219,12 +219,7 @@ impl PdfCraftApp {
|
||||
view.forms.unbaked.extend(unbaked);
|
||||
}
|
||||
} else if let Some(page) = one_page {
|
||||
// Comment and content edits change one page: keep every other raster. Opening,
|
||||
// closing or moving a pop-up changes none: the window is drawn over the page, and
|
||||
// a /Popup annotation paints nothing in the raster (ISO 32000-2 §12.5.6.14).
|
||||
if !matches!(edit, Edit::SetAnnotationPopup { .. }) {
|
||||
view.page_changed(page);
|
||||
}
|
||||
one_page_changed(view, &edit, page);
|
||||
} else if let Some((changed_pages, unbaked)) = form_edit {
|
||||
view.forms.unbaked.extend(unbaked);
|
||||
for page in changed_pages {
|
||||
@@ -946,6 +941,15 @@ fn content_page(edit: &Edit) -> Option<usize> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A comment or content edit changes one page, `page`: keep every other raster. Opening, closing
|
||||
/// or moving a pop-up changes none: the window is drawn over the page, and a /Popup annotation
|
||||
/// paints nothing in the raster (ISO 32000-2 §12.5.6.14).
|
||||
fn one_page_changed(view: &mut crate::DocView, edit: &Edit, page: usize) {
|
||||
if !matches!(edit, Edit::SetAnnotationPopup { .. }) {
|
||||
view.page_changed(page);
|
||||
}
|
||||
}
|
||||
|
||||
fn comment_page(edit: &Edit) -> Option<usize> {
|
||||
match edit {
|
||||
Edit::AddAnnotation(a) => Some(a.page),
|
||||
|
||||
Reference in new issue
Block a user