Skip to content

Hyperlink state improvements (no mouse move, blurred splits/windows on macOS)#2395

Merged
mitchellh merged 2 commits intomainfrom
mods
Oct 6, 2024
Merged

Hyperlink state improvements (no mouse move, blurred splits/windows on macOS)#2395
mitchellh merged 2 commits intomainfrom
mods

Conversation

@mitchellh
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh commented Oct 6, 2024

A couple improvements for hyperlinks:

First, hyperlink state (underline or not plus mouse shape) will change properly when pressing the modifier without having to move the mouse. This was a regression I didn't realize and it's now cleaned up.

Second, I learned about an API I didn't know about before on macOS which lets us get keyboard events without being part of the responder chain or having accessibility privileges (NSEvent.addLocalEventMonitor) so we can use that to detect modifier key changes and propagate them to unfocused surfaces. This fixes a previous known issue I marked as "wontfix" where blurred splits/windows wouldn't update their hyperlink state until focused.

Looking forward, I'm still not super happy with our mouse button or position management in src/Surface.zig. It's extremely complicated, order dependent, etc. and not unit tested at all. The inputs to the structure are not conducive to unit testing. I want to consider an approach similar to src/input/KeyEncoder.zig but for our mouse events so we can make it fully deterministic for testing. In the interest of improving things in the short term, I'm making this PR now, but want to consider this larger change for the future.

Related to #1547

Concretely, if you are highlighting a link and then release the
modifier, the other surfaces will be notified of this change.
This fixes a longstanding piece of tech debt which caused all sorts of
bugs. Instead of trying to jam cursorPosCallback into a modsChanged
event we bring out the link refreshing into a dedicated method that is
shared.
@mitchellh
Copy link
Copy Markdown
Contributor Author

Note: the blurred split/window issue still exists on GTK. I don't know how to fix it there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant