Skip to content

feat(desktop): in-app spot editor for the file preview pane - #52772

Merged
OutThisLife merged 4 commits into
mainfrom
bb/editor
Jun 26, 2026
Merged

feat(desktop): in-app spot editor for the file preview pane#52772
OutThisLife merged 4 commits into
mainfrom
bb/editor

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds basic, in-app code editing to the desktop app's right-rail file preview — a CodeMirror 6 spot editor, deliberately not an IDE. The design goal: entering edit mode is a pure in-place swap of the read view, so nothing about the file's layout, font, or position moves.

  • Spot editor (code-editor.tsx): line numbers, history, selection, bracket matching, GitHub syntax highlighting matched to the read view's Shiki theme (code-editor-theme.ts). No fold gutter / autocomplete / active-line chrome. Follows app light/dark live.
  • No layout shift: edit and read share the same container + a fixed-height header (only the trailing controls swap), and the editor's gutter/typography mirror SourceView 1:1 (including beating CodeMirror's higher-specificity base CSS).
  • Three ways in: the Edit button, a bare e when the pane is hovered/focused (and nothing typable has focus), and the editor auto-focuses on entry. ⌘/Ctrl+S and ⌘/Ctrl+Enter save; Esc cancels.
  • Transport-agnostic save (writeDesktopFileText): local Electron IPC, or a new hardened POST /api/fs/write-text on the dashboard server (path validation, parent-must-exist, regular-files-only, size cap, atomic temp-file + os.replace) — behind the existing auth middleware, so remote/dashboard mode works too.
  • Stale-on-disk guard: re-reads before writing; on external/agent changes it offers overwrite vs discard & reload rather than clobbering.
  • VS Code-style modified dot on the tab (preview-edit.ts); typing stays render-free (draft in a ref, dirty flips once at the boundary).

Also included (separate commit): vertical resize for the bottom-row terminal pane — the pane store gains a heightOverride alongside widthOverride, wired through the pane shell + desktop controller and persisted.

Test plan

  • Open a text file in the preview rail → Edit / e / enter edit; confirm zero layout shift vs the read view (font, gutter, line height, position).
  • Edit + Save (⌘S / ⌘⏎ / button) writes to disk; tab dot appears while dirty, clears on save; Esc/Cancel discards.
  • Stale guard: modify the file externally mid-edit, Save → overwrite vs discard & reload both behave.
  • Remote/dashboard mode: edits save via POST /api/fs/write-text; unauthorized requests rejected.
  • Editing is unavailable for images, binaries, and truncated (>512KB) files.
  • Bottom-row terminal pane resizes vertically and the height persists across relaunch.

Adds a CodeMirror 6 spot editor to the right-rail file preview so users can
make quick edits in-app without leaving for an IDE. Entering edit mode is a
pure in-place swap of the read view — same fixed-height header, same gutter
geometry/typography (mirrors SourceView 1:1) so nothing shifts — toggled via
the Edit button, a bare `e` when the pane is hovered/focused, or the tab.

- Save path is transport-agnostic (writeDesktopFileText): local Electron IPC
  or a new hardened POST /api/fs/write-text on the dashboard server (path
  validation, parent-must-exist, regular-files-only, size cap, atomic
  temp-file + os.replace), behind the existing auth middleware.
- Stale-on-disk guard re-reads before writing and offers overwrite vs
  discard-and-reload instead of clobbering external/agent edits.
- VS Code-style modified dot on the tab; ⌘/Ctrl+S and ⌘/Ctrl+Enter save,
  Esc cancels; GitHub highlight style matched to the read view's Shiki theme.
- Typing stays render-free (draft in a ref; dirty flips once at the boundary).
Extends the pane store with heightOverride (alongside widthOverride) and a
get/set/clear API, and wires the pane shell + desktop controller so the
bottom-row terminal pane can be resized on the Y axis with its size persisted.
@OutThisLife
OutThisLife requested a review from a team June 26, 2026 00:50
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/editor vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11349 on HEAD, 11349 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5985 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

Use the app's amber warn color for the unsaved-edits tab dot (was inheriting
the label text color) and add a tab-bg ring + soft drop shadow so it stays
legible where it overlaps the filename.
@alt-glitch alt-glitch added type/feature New feature or request comp/desktop Electron desktop app (apps/desktop/*) comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have labels Jun 26, 2026
@OutThisLife
OutThisLife merged commit 6b639bc into main Jun 26, 2026
32 checks passed
@OutThisLife
OutThisLife deleted the bb/editor branch June 26, 2026 01:25
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
feat(desktop): in-app spot editor for the file preview pane
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
feat(desktop): in-app spot editor for the file preview pane
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
feat(desktop): in-app spot editor for the file preview pane
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
feat(desktop): in-app spot editor for the file preview pane
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
feat(desktop): in-app spot editor for the file preview pane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants