mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-09 11:26:41 +00:00
core: handle mouse capture events with link highlighting
Fixes #1416 At a high level, the issue is that when mouse capture is enabled (i.e. in neovim), "shift" escapes the capture. So "cmd+shift" is equal to "cmd" which doesn't get sent to the TUI program and so on. For link highlighting which now requires "cmd" (super) is held, we were sending "cmd+shift" to the renderer so we weren't checking for links. So the core of this commit is respecting this scenario and stripping the shift modifier. This commit also found that when the mouse wasn't over a link, we were always checking and highlighting links on line one of the visible screen. This bug is fixed and should also result in a very slight performance improvement on rendering in all cases.
This commit is contained in:
@@ -36,6 +36,11 @@ pub const Highlight = union(enum) {
|
||||
/// hovering or always. For always, all links will be highlighted
|
||||
/// when the mods are pressed regardless of if the mouse is hovering
|
||||
/// over them.
|
||||
///
|
||||
/// Note that if "shift" is specified here, this will NEVER match in
|
||||
/// TUI programs that capture mouse events. "Shift" with mouse capture
|
||||
/// escapes the mouse capture but strips the "shift" so it can't be
|
||||
/// detected.
|
||||
always_mods: Mods,
|
||||
hover_mods: Mods,
|
||||
};
|
||||
|
Reference in New Issue
Block a user