Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change order for processing links in mouse events #2640

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3250,6 +3250,12 @@ pub fn cursorPosCallback(
try self.queueRender();
}

// Process new links. This used to happen after mouse reporting/click detection but
// led to indeterminate behavior. Moving this to the top of the function ensures that
// the link state is always correct and properly displayed for the user. Mouse events
// are still captured correctly and escaped when shift is utilized.
try self.mouseRefreshLinks(pos, pos_vp, over_link);

// Do a mouse report
if (self.io.terminal.flags.mouse_event != .none) report: {
// Shift overrides mouse "grabbing" in the window, taken from Kitty.
Expand Down Expand Up @@ -3358,9 +3364,6 @@ pub fn cursorPosCallback(
return;
}
}

// We can process new links.
try self.mouseRefreshLinks(pos, pos_vp, over_link);
}

/// Double-click dragging moves the selection one "word" at a time.
Expand Down