1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00

mux: fix some dpi and pixel size issues

Three issues:

* The initial connect would leave the dpi assigned to 0, resulting
  in incorrect scaling when using imgcat until the window was resized
  and the correct dpi was passed up.
* On resize, we'd only compare the row/col count and not notice changes
  in pixel dimensions/dpi
* On the server side, when processing a resize and recomputing
  the tab size, we would omit the pixel dimensions and leave
  the resulting tabs and panes with 0 dimensions, breaking imgcat
  because it thought the window was 0x0.

refs: https://github.com/wez/wezterm/issues/3366
This commit is contained in:
Wez Furlong 2023-03-25 20:22:43 -07:00
parent 727cd95dcd
commit 8dd365d4c5
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
4 changed files with 19 additions and 3 deletions

View File

@ -73,6 +73,11 @@ As features stabilize some brief notes about them will accumulate here.
* `CTRL-SHIFT-R` assignment in `CharSelect` mode didn't cycle back through
the emoji categories as intended, but performed the global `ReloadConfiguration`
action instead. #2947
* mux: resizing the window larger, then spawning a tab, would result in the new
tab having pixel dimensions of 0 and prevent imgcat from functioning until the
tab was explicitly resized. #3366
* mux: initial attach and spawn would leave the dpi at the assumed dpi resulting
in incorrect image scaling for imgcat. #3366
#### Updated
* Bundled JetBrainsMono to 2.304. #3362

View File

@ -1206,8 +1206,8 @@ impl TabInner {
let size = TerminalSize {
cols: dims.cols,
rows: dims.viewport_rows,
pixel_height: 0,
pixel_width: 0,
pixel_height: dims.pixel_height,
pixel_width: dims.pixel_width,
dpi: dims.dpi,
};
Some(size)

View File

@ -344,9 +344,15 @@ impl Pane for ClientPane {
let cols = size.cols as usize;
let rows = size.rows as usize;
if inner.dimensions.cols != cols || inner.dimensions.viewport_rows != rows {
if inner.dimensions.cols != cols
|| inner.dimensions.viewport_rows != rows
|| inner.dimensions.pixel_width != size.pixel_width
|| inner.dimensions.pixel_height != size.pixel_height
{
inner.dimensions.cols = cols;
inner.dimensions.viewport_rows = rows;
inner.dimensions.pixel_width = size.pixel_width;
inner.dimensions.pixel_height = size.pixel_height;
// Invalidate any cached rows on a resize
inner.make_all_stale();

View File

@ -1142,8 +1142,13 @@ impl TermWindow {
if size.rows != self.terminal_size.rows
|| size.cols != self.terminal_size.cols
|| size.pixel_width != self.terminal_size.pixel_width
|| size.pixel_height != self.terminal_size.pixel_height
{
self.set_window_size(size, window)?;
} else if tab_size.dpi == 0 {
log::debug!("fixup dpi in newly added tab");
tab.resize(self.terminal_size);
}
}
}