Skip to content

feat(explorer): configurable double-click action for files#80

Merged
macnev2013 merged 4 commits into
mainfrom
feat/explorer-doubleclick-action
Jun 15, 2026
Merged

feat(explorer): configurable double-click action for files#80
macnev2013 merged 4 commits into
mainfrom
feat/explorer-doubleclick-action

Conversation

@macnev2013

Copy link
Copy Markdown
Owner

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:

  • Download — the current behaviour (default, so nothing changes unless opted in).
  • Open in Editor — opens the file in the configured default external editor.

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.tsexplorerDoubleClickAction: "download" | "open", persisted as explorer_double_click_action in the existing key-value app_settings table. No schema/migration change.
  • SettingsPage.tsx — new "Explorer" section (FolderOpen icon) with a SegmentedControl.
  • ExplorerFileTable.tsxhandleDoubleClick honours the setting; "open" uses the default editor via the existing onEditInEditor path (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 --noEmit clean; full Vitest suite green (the one unrelated, pre-existing DropOverwriteDialog failure aside).

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.
@macnev2013 macnev2013 added the enhancement New feature or request label Jun 15, 2026
@macnev2013 macnev2013 added this to the v0.10.4 milestone Jun 15, 2026
…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.
@macnev2013 macnev2013 merged commit 4090805 into main Jun 15, 2026
7 checks passed
@macnev2013 macnev2013 deleted the feat/explorer-doubleclick-action branch June 15, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant