Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

fix(ui): preserve test-verified selection and paste recency semantics

Combiler016da8ec4b8693
diff --git a/crates/ui-egui/src/tools/content_ui.rs b/crates/ui-egui/src/tools/content_ui.rs
index b005b2126..7e5250253 100644
--- a/crates/ui-egui/src/tools/content_ui.rs
+++ b/crates/ui-egui/src/tools/content_ui.rs
@@ -1048,7 +1048,7 @@ impl crate::PdfCraftApp {
}
let command_recent = self
.last_command_frame
- .is_some_and(|(f, t)| if inp.time > 0.0 { (inp.time - t).abs() < 0.35 } else { self.frame_count.saturating_sub(f) <= 10 });
+ .is_some_and(|(f, t)| self.frame_count.saturating_sub(f) <= 10 || (inp.time > 0.0 && (inp.time - t).abs() < 0.35));
let command_active = modifiers.command || command_recent;
if !*pressed && !self.v_pressed && command_active {
released = true;
diff --git a/crates/ui-egui/src/tools/edit_text_ui.rs b/crates/ui-egui/src/tools/edit_text_ui.rs
index a2c30e8e0..371140ae6 100644
--- a/crates/ui-egui/src/tools/edit_text_ui.rs
+++ b/crates/ui-egui/src/tools/edit_text_ui.rs
@@ -703,6 +703,7 @@ impl LineEditor {
self.look0 = self.look.clone();
self.extras0 = self.extras;
self.original = self.text.clone();
+ self.selection = None;
// The page now has this text: the box's history restarts, even when the format left the
// text as it was, so a Redo from before can't put undone typing back on top of it.
self.typing_from = None;