feat(explorer): configurable double-click action for files#80
Merged
Conversation
Adds a Settings → Explorer section with a "Double-click a File" option:
Download (current behaviour, the default) or Open in Editor. Opening uses
the default external editor and falls back to download when no editor is
configured or the provider can't edit, so double-click is always safe.
- settings-store: explorerDoubleClickAction ("download" | "open"), persisted
under explorer_double_click_action in the existing key-value store — no
migration.
- SettingsPage: a new "Explorer" section with a segmented control.
- ExplorerFileTable: handleDoubleClick honours the setting; directories still
navigate. Shared by the SFTP, SCP, and S3 browsers.
- Tests: settings-store coverage for the new setter and load parsing
(incl. fallback for an unknown value).
…click With the double-click action set to "Open in Editor", every file was sent to the editor — including binaries like .mov and .pdf, which are useless there. Add an isEditableInEditor() helper that recognizes common binary families (video, audio, images, documents, archives, executables, fonts, databases) and route those to download instead; extensionless files and dotfiles (Dockerfile, .env, …) are treated as text. The Edit / Open With context-menu actions are intentionally not filtered, so a user can still force any file open.
…viours Behaviour tests for the two features, exercising the actual component wiring (the store/helper logic was already unit-tested): - ExplorerFileTable double-click: directory navigates; a file downloads in "download" mode, opens in the editor in "open" mode for text files, and still downloads for binaries (.mov) or when no editor is configured. - Terminal clipboard (#71): copy-on-select writes the selection only when enabled; middle-click pastes when the paste button is "middle", right-click when "right"; the wrong button or "off" pastes nothing.
…e targets) The "fires onCancel on Cancel, backdrop click, and Escape" case never passed when the suite is actually run (two bugs, the second masked by the first): - It clicked the dialog panel — the testId is on the panel — instead of the backdrop. ModalShell closes only when the click target IS the backdrop, so onCancel didn't fire. Click the panel's parent (the backdrop) instead. - It dispatched the Escape keydown on window, but ModalShell's listener is on document, which a window-targeted event never reaches. Dispatch on document.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new Settings → Explorer section with a Double-click a File option, so users can choose what happens when they double-click a file in the browser:
Opening falls back to downloading when no editor is configured or the provider can't edit, so a double-click never silently does nothing. Directories still navigate as before.
This mirrors the per-domain settings pattern (like Terminal → Clipboard from #79) and gives the Explorer its own settings home, ready for future file-browser options.
Implementation
settings-store.ts—explorerDoubleClickAction: "download" | "open", persisted asexplorer_double_click_actionin the existing key-valueapp_settingstable. No schema/migration change.SettingsPage.tsx— new "Explorer" section (FolderOpen icon) with aSegmentedControl.ExplorerFileTable.tsx—handleDoubleClickhonours the setting; "open" uses the default editor via the existingonEditInEditorpath (sftp_edit_external/s3_edit_external). Shared by the SFTP, SCP, and S3 browsers.Tests
settings-store.test.ts: default, setter + persisted value, and load parsing with a fallback for an unknown value.tsc --noEmitclean; full Vitest suite green (the one unrelated, pre-existingDropOverwriteDialogfailure aside).