Skip to content

Commit 87eecf8

Browse files
committed
fix: route damage events across all grids
ContextManager::get_by_route_id only looked inside the current grid, so TerminalDamaged events from background tabs were silently dropped. The PTY side had already set damage_event_in_flight=true when sending the event, and nothing ever reset it, so once the user switched back to that tab its terminal could not emit further damage notifications until something forced a full render (a click or a tab-switch shortcut). Search all grids instead. The dirty flag accumulates on the background panel's renderable content, and when the user brings that tab forward the renderer processes the pending damage and clears in_flight on the next frame. The terminal buffer retains its damage state in the meantime, so nothing is lost. Surfaced by 1-tab to 2-tab to 1-tab transitions where the tab-bar margin change actually resized the background terminal and made its shell emit data while it was in the background.
1 parent 0d11ee2 commit 87eecf8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • frontends/rioterm/src/context

frontends/rioterm/src/context/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,16 @@ impl<T: EventListener + Clone + std::marker::Send + 'static> ContextManager<T> {
757757
&mut self,
758758
route_id: usize,
759759
) -> Option<&mut ContextGridItem<T>> {
760-
self.contexts[self.current_index].get_by_route_id(route_id)
760+
// Search all grids, not just the current one: damage events from
761+
// background tabs must still reach their own panel so dirty flags
762+
// accumulate and the terminal's damage_event_in_flight can be reset
763+
// on the next render. Looking only at the current grid silently
764+
// drops those events and leaves the background terminal's
765+
// in_flight=true, which blocks subsequent notifications even after
766+
// the tab is brought back to the foreground.
767+
self.contexts
768+
.iter_mut()
769+
.find_map(|grid| grid.get_by_route_id(route_id))
761770
}
762771

763772
#[inline]

0 commit comments

Comments
 (0)