Skip to content

Conversation

@chirag-bruno
Copy link
Contributor

Description

This PR resolves issue #4982.

It introduces support for Cmd+Click (macOS) and Ctrl+Click (Windows/Linux) to open links directly, improving navigation and usability within the editor.

This work builds upon [@abansal21’s original contribution](#5160).
Due to merge conflicts and to ensure consistency across CodeMirror extension implementations, their approach has been slightly refined and the related tests have been updated.

References:


Contribution Checklist

@chirag-bruno chirag-bruno changed the base branch from main to feature/cmd-click-to-links-internal October 29, 2025 17:11
@sid-bruno sid-bruno mentioned this pull request Nov 12, 2025
5 tasks
Copy link
Collaborator

@sid-bruno sid-bruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nitpicks to be done

Comment on lines 176 to 177
if (this.editor?._destroyLinkAware) {
this.editor?._destroyLinkAware?.();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either keep the ?. exec pattern or the if condition

Comment on lines 161 to 162
if (this.editor?._destroyLinkAware) {
this.editor?._destroyLinkAware?.();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

Comment on lines 11 to 17
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lodash is already a part of the package, use that instead of writing this

@sid-bruno sid-bruno merged commit efb3c56 into usebruno:feature/cmd-click-to-links-internal Nov 18, 2025
1 check passed
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Nov 18, 2025
fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (usebruno#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Nov 18, 2025
Co-authored-by: Chirag Chandrashekhar <[email protected]>

fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (usebruno#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Nov 18, 2025
fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (usebruno#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
sid-bruno added a commit to sid-bruno/bruno that referenced this pull request Nov 18, 2025
fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (usebruno#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
sid-bruno added a commit that referenced this pull request Nov 18, 2025
fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
sid-bruno added a commit that referenced this pull request Nov 18, 2025
* feat: Allow ctrl/cmd + click to open URLs present in codemirror editors (#5160)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

---------

Co-authored-by: Sid <[email protected]>

* Feature/cmd click on links (#5927)

fix: clean up whitespace and formatting in linkAware functions

fix rediff

Feature/cmd click on links (#6132)

* Allow ctrl/cmd + click to open URLs

* fix for when user does cmd+tab, then comes back without it

* refactored the community contribution to match Autocomplete's implementation

* updated the code to resolve issues caused during merge conflict resolution with the use of makeLinkAware

* fix: updated the code to use lodash's debounce and removed redundant undefined checks

* fix: correct debouncing test expectation in linkAware.spec.js

The test was incorrectly expecting 3 setTimeout calls when debouncing
should only result in one active timeout. Updated the test to verify
debouncing behavior correctly by checking that setTimeout is called
with the correct delay, and that only one execution happens after
the debounce delay.

* fix: fixed merge issues in linkAware.js

* fix: fixed CodeMirror assignment to this.editor

* fix: formatting fixes

* fix: formatting fix

---------

Co-authored-by: abansal21 <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>

---------

Co-authored-by: Arun Bansal <[email protected]>
Co-authored-by: Chirag Chandrashekhar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants