Skip to content

editor: auto-save on Esc instead of the discard prompt#17

Closed
jrdntnnr wants to merge 1 commit into
clackups:mainfrom
jrdntnnr:esc-autosave
Closed

editor: auto-save on Esc instead of the discard prompt#17
jrdntnnr wants to merge 1 commit into
clackups:mainfrom
jrdntnnr:esc-autosave

Conversation

@jrdntnnr

Copy link
Copy Markdown
Contributor

What this does

Changes the editor's Esc-to-close behavior from a discard-confirmation prompt to auto-save.

Previously, pressing Esc on a modified buffer showed Unsaved! Ctrl+S:Save Esc:Discard, and a reflexive second Esc silently discarded the edits. Now:

  • A named file is saved in place.
  • A never-saved buffer is written under a generated draft name (the same generator the Save dialog uses, so it can be renamed afterwards).
  • Only if the save itself fails (SD card missing/full) does it fall back to the original two-step discard prompt — so work is never lost silently, and you're never trapped in the editor.

Board-agnostic editor UX change. Build-verified on ESP-IDF 5.5. Split out of #14 per maintainer request (this was a general behavior change bundled in the H752 branch; raising it separately so it can be reviewed on its own merits).

Closing a modified buffer with Esc previously required a two-step
"Unsaved! Ctrl+S:Save  Esc:Discard" confirmation, where a reflexive
second Esc silently threw away the edits. Auto-save instead: a named
file is saved in place; a never-saved buffer is written under a
generated draft name (the same generator the Save dialog uses, so it
can be renamed later). Only if the save itself fails (SD card missing
or full) do we fall back to the original two-step discard prompt, so
work is never lost silently nor trapped in the editor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clackups

Copy link
Copy Markdown
Owner

we still need to give the user a possibility to exit the editor without saving. Probably, a proper dialog, like "Save? yes/no", would be more intuitive.

@clackups

Copy link
Copy Markdown
Owner

I'll add a proper dialog

@clackups clackups closed this Jun 11, 2026
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.

2 participants