Snapshot: a document change puts the copied area away

Its page index would name another page after pages were deleted or moved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Osvaldo Duran MelendezandClaude Sonnet 5.5 committed 2026-11-09 18:28:36 -05:00
1 parent a50b52ea84
commit 3613779a01
2 files changed
+14

No files matched your search

+4
View File
@@ -1214,6 +1214,10 @@ impl DocView {
if self.select_anchor.is_some_and(|a| a > last) {
self.select_anchor = None;
}
// A Snapshot area names a page by its index and a rectangle on it: after pages were
// deleted or moved it would outline, print and save a different page.
self.area_pick = None;
self.area_choice = None;
self.goto = None;
self.goto_point = None;
self.zoom_anchor = None;
@@ -71,3 +71,13 @@ fn leaving_snapshot_clears_every_tab() {
assert!(h.state().views[1].area_pick.is_none(), "the tab on screen");
assert!(h.state().views[0].area_pick.is_none(), "the other tab");
}
/// A change to the page list leaves no area behind: its page index would name another page.
#[test]
fn a_document_change_puts_the_area_away() {
let mut h = harness();
h.state_mut().views[0].area_pick = Some((0, [10.0, 130.0, 150.0, 170.0]));
let info = h.state().session.get(h.state().views[0].id).unwrap().info.clone();
h.state_mut().views[0].document_changed(&info);
assert!(h.state().views[0].area_pick.is_none());
}