fix CloseCurrentPane leaving a stranded pane in a tab

Repro for this issue was:

```console
$ WEZTERM_LOG=mux=trace,info ./target/debug/wezterm -n --config 'exit_behavior="CloseOnCleanExit"'
```

Then:

* Split left/right
* CloseCurrentPane

refs: #4030
This commit is contained in:
Wez Furlong committed 2023-08-28 07:28:23 -07:00
1 parent cb0e1599ac
commit a103b6d97a
2 files changed
+20 -1

No files matched your search

+1
View File
@@ -92,6 +92,7 @@ As features stabilize some brief notes about them will accumulate here.
* Text cursor filled the scaled-by `line_height` and `cell_width` dimensions rather
than the native font dimensions and looked weird when either config option was
not set to `1.0`. #2882
* Using `CloseCurrentPane` could sometimes leave a stranded pane in a tab. #4030
#### Updated
* Bundled harfbuzz to 8.1.1
+19 -1
View File
@@ -1554,8 +1554,26 @@ impl TabInner {
}
fn prune_dead_panes(&mut self) -> bool {
let mux = Mux::get();
!self
.remove_pane_if(|_, pane| pane.is_dead(), true)
.remove_pane_if(
|_, pane| {
// If the pane is no longer known to the mux, then its liveness
// state isn't guaranteed to be monitored or updated, so let's
// consider the pane effectively dead if it isn't in the mux.
// <https://github.com/wez/wezterm/issues/4030>
let in_mux = mux.get_pane(pane.pane_id()).is_some();
let dead = pane.is_dead();
log::trace!(
"prune_dead_panes: pane_id={} dead={} in_mux={}",
pane.pane_id(),
dead,
in_mux
);
dead || !in_mux
},
true,
)
.is_empty()
}