mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
wezterm: speculative workaround for RDP disconnect panic
Attempt to recover in the case where we cannot re-allocate our vertex buffers; try to restore the prior dimensions and resize the OS window to match. refs: https://github.com/wez/wezterm/issues/265
This commit is contained in:
parent
d939211dc5
commit
3484478ba2
@ -1769,8 +1769,10 @@ impl TermWindow {
|
||||
fn apply_dimensions(
|
||||
&mut self,
|
||||
dimensions: &Dimensions,
|
||||
scale_changed_cells: Option<RowsAndCols>,
|
||||
mut scale_changed_cells: Option<RowsAndCols>,
|
||||
) {
|
||||
let orig_dimensions = self.dimensions;
|
||||
|
||||
self.dimensions = *dimensions;
|
||||
|
||||
// Technically speaking, we should compute the rows and cols
|
||||
@ -1830,20 +1832,29 @@ impl TermWindow {
|
||||
(size, *dimensions)
|
||||
};
|
||||
|
||||
self.render_state
|
||||
.advise_of_window_size_change(
|
||||
if let Err(err) = self.render_state.advise_of_window_size_change(
|
||||
&self.render_metrics,
|
||||
dimensions.pixel_width,
|
||||
dimensions.pixel_height,
|
||||
)
|
||||
.expect("failed to advise of resize");
|
||||
|
||||
) {
|
||||
log::error!(
|
||||
"failed to advise of resize from {:?} -> {:?}: {:?}",
|
||||
orig_dimensions,
|
||||
dimensions,
|
||||
err
|
||||
);
|
||||
// Try to restore the original dimensions
|
||||
self.dimensions = orig_dimensions;
|
||||
// Avoid the inner resize below
|
||||
scale_changed_cells.take();
|
||||
} else {
|
||||
self.terminal_size = size;
|
||||
}
|
||||
|
||||
let mux = Mux::get().unwrap();
|
||||
if let Some(window) = mux.get_window(self.mux_window_id) {
|
||||
for tab in window.iter() {
|
||||
tab.resize(size).ok();
|
||||
tab.resize(self.terminal_size).ok();
|
||||
}
|
||||
};
|
||||
self.update_title();
|
||||
|
Loading…
Reference in New Issue
Block a user