mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-10 11:19:45 +00:00
renderer: avoid starving scrollback compression
Inspector rendering can hold the terminal mutex while waking the renderer. When the compression scheduler failed to acquire that mutex, it treated every wake as possible terminal activity and restarted the idle timer. Frequent inspector frames could therefore postpone compression indefinitely until another interaction changed the timing. Keep an existing compression deadline when a wake encounters lock contention. The timer callback already rechecks both terminal activity and lock availability, while the first contended wake still arms a timer when none is active.
This commit is contained in:
@@ -792,10 +792,17 @@ const Compression = struct {
|
||||
const activity = thread.state.terminal.compressionActivity();
|
||||
if (self.activity == activity) return;
|
||||
self.activity = activity;
|
||||
} else if (self.completion.state() == .active) {
|
||||
// Contention doesn't prove that compression-relevant activity
|
||||
// changed. Keep an existing deadline so frequent inspector frames
|
||||
// cannot postpone compression forever. The timer rechecks both the
|
||||
// activity token and lock availability before doing any work.
|
||||
return;
|
||||
}
|
||||
|
||||
// Contention may mean parsing is active. Scheduling is a harmless
|
||||
// false positive when no compression work is actually pending.
|
||||
// false positive when no compression work is actually pending, but is
|
||||
// necessary when no timer is already active.
|
||||
self.schedule(thread, idle_interval);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user