aboutsummaryrefslogtreecommitdiff
path: root/src/app/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/runtime.rs')
-rw-r--r--src/app/runtime.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/app/runtime.rs b/src/app/runtime.rs
index 85bdb8dd..bbef7444 100644
--- a/src/app/runtime.rs
+++ b/src/app/runtime.rs
@@ -179,6 +179,8 @@ impl App {
changed = true;
}
+ changed |= self.clear_due_selection_highlight(now);
+
self.start_git_status_refresh_if_due(now);
if self
@@ -199,6 +201,28 @@ impl App {
changed
}
+ /// Clears temporary copied-token highlights, such as after double-click copy.
+ pub(crate) fn clear_due_selection_highlight(&mut self, now: Instant) -> bool {
+ if self
+ .selection_highlight_clear_deadline
+ .is_none_or(|deadline| now < deadline)
+ {
+ return false;
+ }
+
+ self.selection_highlight_clear_deadline = None;
+ if self
+ .state
+ .selection
+ .as_ref()
+ .is_some_and(|selection| !selection.is_in_progress())
+ {
+ self.state.clear_selection();
+ return true;
+ }
+ false
+ }
+
pub(crate) fn sync_animation_timer(&mut self, now: Instant) {
self.sync_animation_timer_with_interval(now, ANIMATION_INTERVAL);
}
@@ -412,6 +436,7 @@ impl App {
self.next_auto_update_check,
self.session_save_deadline,
self.selection_autoscroll_deadline,
+ self.selection_highlight_clear_deadline,
render_deadline,
]
.into_iter()