aboutsummaryrefslogtreecommitdiff
path: root/src/app/runtime.rs
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-08-18 04:37:11 +0300
committerGitHub <noreply@github.com>2026-08-18 04:37:11 +0300
commit2d24950ad9a02096921bc764e2e3dcd8900c3366 (patch)
treeb6884a29425922dfed083bb7108415ae56725a45 /src/app/runtime.rs
parentd497ee14dd3f2b5325a16d0de779ed6bd62178ee (diff)
fix: isolate hidden pane render cadence (#2892)
refs #2890 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Diffstat (limited to 'src/app/runtime.rs')
-rw-r--r--src/app/runtime.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/app/runtime.rs b/src/app/runtime.rs
index d7023727..8367a223 100644
--- a/src/app/runtime.rs
+++ b/src/app/runtime.rs
@@ -534,6 +534,22 @@ impl App {
}
}
+ pub(crate) fn can_present_now(&self, now: Instant) -> bool {
+ match self.last_presentation_at {
+ Some(last_presentation_at) => {
+ now.duration_since(last_presentation_at) >= MIN_RENDER_INTERVAL
+ }
+ None => true,
+ }
+ }
+
+ pub(crate) fn record_render_attempt(&mut self, now: Instant, presentation: bool) {
+ self.last_render_at = Some(now);
+ if presentation {
+ self.last_presentation_at = Some(now);
+ }
+ }
+
pub(crate) fn run_auto_update_check(&mut self) {
if !background_update_check_enabled(self.no_session, self.update_version_check_enabled) {
self.next_auto_update_check = None;
@@ -658,6 +674,20 @@ mod tests {
use crate::workspace::Workspace;
#[test]
+ fn hidden_render_attempt_keeps_presentation_cadence_available() {
+ let (mut app, _) = test_app_with_pane();
+ let initial_presentation = Instant::now();
+ app.record_render_attempt(initial_presentation, true);
+
+ let hidden_attempt = initial_presentation + MIN_RENDER_INTERVAL;
+ app.record_render_attempt(hidden_attempt, false);
+ let foreground_echo = hidden_attempt + Duration::from_millis(1);
+
+ assert!(!app.can_render_now(foreground_echo));
+ assert!(app.can_present_now(foreground_echo));
+ }
+
+ #[test]
fn interrupted_detached_process_wait_keeps_child_for_retry() {
let interrupted = std::io::Error::new(std::io::ErrorKind::Interrupted, "test interrupt");