editor: Fix cmd + click on a URL not working sometimes (#26128)
Closes #25647 This PR fixes two issues related to cmd + click on URL: 1. Normally cmd + click on URL, it opens browser. Now, alt + tab back to Zed. If you cmd + click on link again it won't work, until you normal click some where else in buffer. It won't even show underline. 2. Again, cmd + click on URL, it opens browser. Now, alt + tab back to Zed. If you cmd + click, some where else in buffer like just normal text, and now try to hover on URL it won't show up underline and cmd + click on it won't work. Unless again, if you plain click somewhere else. Problem: Issue is when clicking we set pending anchor (for selection), and when we mouse up we clear those. This works for normal case without pressing any modifier. But, in case of cmd modifier, we set pending anchor (set when `SelectPhase::Begin`), but we don't clear it once we use that data. Fix: Once we end up using selection, anchor, etc data to figure out where to navigate either URL/defination etc, we clear selection just like how we do it in normal click. This doesn't require to happen after navigate task, so we do it right after our usage of it. Before: https://github.com/user-attachments/assets/b33d93fc-f490-4fa4-ae22-1da1fd6b77a9 After: https://github.com/user-attachments/assets/028f039a-cd13-4651-b461-3ba52f2526de Release Notes: - Fixed an issue where cmd + click on a URL was not working sometimes.
S
smit committed
e061ebb46ce8b0f921d0b205059d9a8cdea25a04
Parent: 387ee46
Committed by GitHub <noreply@github.com>
on 3/5/2025, 3:28:18 PM