-
Notifications
You must be signed in to change notification settings - Fork 964
feat(desktop): cmd-click file paths opens in external editor #2903
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,17 +111,25 @@ export function FileItem({ | |
|
|
||
| const fileDragProps = useFileDrag({ absolutePath }); | ||
|
|
||
| const handleClick = useCallback(() => { | ||
| if (clickTimeoutRef.current) { | ||
| clearTimeout(clickTimeoutRef.current); | ||
| clickTimeoutRef.current = null; | ||
| } | ||
| const handleClick = useCallback( | ||
| (e: React.MouseEvent) => { | ||
| if (e.metaKey || e.ctrlKey) { | ||
| openInEditor(); | ||
| return; | ||
| } | ||
|
Comment on lines
+116
to
+119
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Yes, in the DOM event model, when a user double-clicks an element, two click events are fired before the dblclick event fires. An immediate click event handler will run twice—once for each individual click in the double-click sequence. Citations:
Cmd/Ctrl-double-click opens the editor twice. When a user Cmd/Ctrl+double-clicks, the modifier branch (Lines 116–119) fires immediately on both 🤖 Prompt for AI Agents |
||
|
|
||
| if (clickTimeoutRef.current) { | ||
| clearTimeout(clickTimeoutRef.current); | ||
| clickTimeoutRef.current = null; | ||
| } | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
|
|
||
| clickTimeoutRef.current = setTimeout(() => { | ||
| clickTimeoutRef.current = null; | ||
| onClick(); | ||
| }, 300); | ||
| }, [onClick]); | ||
| clickTimeoutRef.current = setTimeout(() => { | ||
| clickTimeoutRef.current = null; | ||
| onClick(); | ||
| }, 300); | ||
| }, | ||
| [onClick, openInEditor], | ||
| ); | ||
|
|
||
| const handleDoubleClick = useCallback( | ||
| (e: React.MouseEvent) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,11 @@ export function FileSearchResultItem({ | |
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Double-click still opens the external editor; this reintroduces the old behavior instead of reserving double-click for future pinning. Prompt for AI agents |
||
| const handleClick = (e: React.MouseEvent) => { | ||
| if (!entry.isDirectory) { | ||
| onActivate(entry, e.metaKey || e.ctrlKey ? true : undefined); | ||
| if (e.metaKey || e.ctrlKey) { | ||
| onOpenInEditor(entry); | ||
| } else { | ||
| onActivate(entry); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,8 +78,10 @@ export function FileTreeItem({ | |
| } else { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Double-click still opens the external editor here, which contradicts the intended behavior that double-click should no longer open externally. Prompt for AI agents |
||
| item.expand(); | ||
| } | ||
| } else if (e.metaKey || e.ctrlKey) { | ||
| onOpenInEditor(entry); | ||
| } else { | ||
| onActivate(entry, e.metaKey || e.ctrlKey ? true : undefined); | ||
| onActivate(entry); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Double-click still opens the external editor, which contradicts the intended interaction change (only cmd/ctrl-click should open externally).
Prompt for AI agents