diff options
| author | skewb1k <skewb1kunix@gmail.com> | 2025-09-01 20:11:21 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-01 17:11:21 +0000 |
| commit | 97fde106c0a3ea97d399d5da3829579a483a5768 (patch) | |
| tree | 569cf19acc40963b1d21759189c0c7e024386592 | |
| parent | 8e0327b3fb747289f47c327b9fcf8b4fd110f9a1 (diff) | |
| download | r-alacritty-97fde106c0a3ea97d399d5da3829579a483a5768.tar.gz r-alacritty-97fde106c0a3ea97d399d5da3829579a483a5768.tar.bz2 r-alacritty-97fde106c0a3ea97d399d5da3829579a483a5768.zip | |
Fix hint highlighting when hovering with hidden mouse
When the mouse cursor was hidden with `hide_when_typing` enabled, hints
could still be highlighted under the hidden cursor. This typically
occurred when a hint moved underneath the stationary, hidden cursor.
This fix ensures hints are not highlighted by the mouse cursor while
it's hidden.
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | alacritty/src/display/mod.rs | 5 | ||||
| -rw-r--r-- | alacritty/src/display/window.rs | 5 | ||||
| -rw-r--r-- | alacritty/src/event.rs | 5 |
4 files changed, 17 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d5bfc208..22ad4618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Notable changes to the `alacritty_terminal` crate are documented in its ## 0.17.0-dev +### Changed + +- Don't highlight hints on hover when the mouse cursor is hidden + ## 0.16.0 ### Packaging diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index ff4d9734..a651d4e0 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -1081,7 +1081,10 @@ impl Display { } // Abort if mouse highlighting conditions are not met. - if !mouse.inside_text_area || !term.selection.as_ref().is_none_or(Selection::is_empty) { + if !self.window.mouse_visible() + || !mouse.inside_text_area + || !term.selection.as_ref().is_none_or(Selection::is_empty) + { if self.highlighted_hint.take().is_some() { self.damage_tracker.frame().mark_fully_damaged(); dirty = true; diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index a91df304..2821b0e0 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -277,6 +277,11 @@ impl Window { } } + #[inline] + pub fn mouse_visible(&self) -> bool { + self.mouse_visible + } + #[cfg(not(any(target_os = "macos", windows)))] pub fn get_platform_window( identity: &Identity, diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 0ff3c6fd..8bb2b902 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1208,8 +1208,11 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon } // Hide mouse cursor. - if self.config.mouse.hide_when_typing { + if self.config.mouse.hide_when_typing && self.display.window.mouse_visible() { self.display.window.set_mouse_visible(false); + + // Request hint highlights update, since the mouse may have been hovering a hint. + self.mouse.hint_highlight_dirty = true } } |