Skip to content

feat(editor): clearer edit controls — Edits label, Save emphasis, Save/Cancel#928

Merged
backnotprop merged 2 commits into
mainfrom
fix/editor-control-labels
Jun 17, 2026
Merged

feat(editor): clearer edit controls — Edits label, Save emphasis, Save/Cancel#928
backnotprop merged 2 commits into
mainfrom
fix/editor-control-labels

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Polishes the markdown edit-mode controls (from #890) based on direct UX feedback. No server changes; plan-mode behavior is unchanged.

Changes

1. Annotation panel: "Direct edits" → "Edits"

The pinned direct-edits card label line-broke at narrow panel widths. Shortened to "Edits".

2. Save button — state-machine driven, zero layout shift

  • Now reads the editableDocuments state machine (saveStatus) as the single source of truth, instead of a parallel editorDiffersFromBaseline flag. (The old logic was also inverted — it lit up when already saved.)
  • Shows a dot + emphasis only when there are unsaved disk changes; muted "Saved" when in sync; "Saving" in flight.
  • Destructive (red) dot + label on a failed save (disk conflict / write error) so it reads as "save failed, retry."
  • No reflow: the dot slot is always reserved (only its color changes) and the label width is pinned to its widest value ("Saving") via an invisible sizer, so Save/Saving/Saved swap without nudging neighbors.

3. Edit exit control: Save + Cancel

  • A source-backed session with unsaved edits now shows a two-step "Cancel" → "Discard?" that discards edits and exits — replacing the ambiguous "Done" that some users feared would lose their work.
  • Plan mode and clean source sessions keep "Done" (commit edits + exit). Plan-mode keep behavior is intentionally unchanged, since plan mode has no disk-save and relies on commit-on-exit.

Behavior note: in source-backed mode the two-button model (Save = keep to disk, Cancel = discard) removes the old path of sending unsaved edits to the agent as a diff without writing to the file. Plan mode still supports that.

Test

  • bun run typecheck — clean
  • bun run build:hook — bundles clean
  • Verified the Save state ladder (clean/dirty/saving/saved/conflict) and the Cancel two-step (arm → discard, reset on save/exit) by tracing the editableDocuments transitions; plan-mode path confirmed untouched.

…e/Cancel

Annotation panel: rename the pinned 'Direct edits' card label to 'Edits'
(it line-broke at narrow panel widths).

Save button (source-backed sessions): drive its state entirely from the
editableDocuments state machine instead of a parallel flag. Shows a dot +
emphasis only when there are unsaved disk changes (was inverted before,
lighting up when already saved), turns destructive on a failed save, and
no longer reflows — the dot slot is always reserved and the label width is
pinned to its widest value so Save/Saving/Saved swap without nudging
neighbors.

Edit exit control: a source-backed session with unsaved edits now shows a
two-step 'Cancel' (-> 'Discard?') that discards edits and exits, instead
of the ambiguous 'Done'. Plan mode and clean source sessions keep 'Done'
(commit edits + exit), so plan-mode keep behavior is unchanged.
In folder annotate mode the editor stays open across files, but the
'Cancel' -> 'Discard?' confirmation was a single app-level flag. Arming it
on one dirty file and switching to another dirty file carried the armed
state over, so the first click discarded the second file's edits with no
confirmation. Reset the confirmation whenever the active editable document
changes so each file's discard is independent.
@backnotprop backnotprop merged commit 4d5a73a into main Jun 17, 2026
13 checks passed
@backnotprop backnotprop deleted the fix/editor-control-labels branch June 17, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant