1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-03 19:53:40 +03:00

fix hover state for retro tab bar

Make the math consistent between the hover logic and the render
logic.

refs: https://github.com/wez/wezterm/issues/3113
This commit is contained in:
Wez Furlong 2023-03-19 09:09:54 -07:00
parent d541e2e13d
commit 7a6dce3ff0
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
3 changed files with 9 additions and 22 deletions

View File

@ -150,6 +150,9 @@ As features stabilize some brief notes about them will accumulate here.
* [wezterm.time.call_after](config/lua/wezterm.time/call_after.md) would not
work when used in an event callback.
[#3026](https://github.com/wez/wezterm/issues/3026)
* Hover state not correctly indicated for retro tab bar when showing at
the bottom of the window
[#3113](https://github.com/wez/wezterm/issues/3113)
#### Changed
* `CTRL-SHIFT-P` now activates the new [command

View File

@ -1762,29 +1762,13 @@ impl TermWindow {
let active_tab = tabs.iter().find(|t| t.is_active).cloned();
let active_pane = panes.iter().find(|p| p.is_active).cloned();
let v_context = DimensionContext {
dpi: self.dimensions.dpi as f32,
pixel_max: self.terminal_size.pixel_height as f32,
pixel_cell: self.render_metrics.cell_size.height as f32,
};
let padding_top = self.config.window_padding.top.evaluate_as_pixels(v_context) as u16;
let padding_bottom = self
.config
.window_padding
.bottom
.evaluate_as_pixels(v_context) as u16;
let border = self.get_os_border();
let tab_bar_height = self.tab_bar_pixel_height().unwrap_or(0.);
let tab_bar_y = if self.config.tab_bar_at_bottom {
let avail_height = self
.dimensions
.pixel_height
.saturating_sub((padding_top + padding_bottom) as usize);
let num_rows = avail_height as usize / self.render_metrics.cell_size.height as usize;
num_rows as i64 - 1
((self.dimensions.pixel_height as f32) - (tab_bar_height + border.bottom.get() as f32))
.max(0.)
} else {
0
border.top.get() as f32
};
let tab_bar_height = self.tab_bar_pixel_height().unwrap_or(0.);

View File

@ -191,7 +191,7 @@ impl super::TermWindow {
match (self.last_ui_item.take(), &ui_item) {
(Some(prior), Some(item)) => {
if prior != *item {
if prior != *item || !self.config.use_fancy_tab_bar {
self.leave_ui_item(&prior);
self.enter_ui_item(item);
context.invalidate();