Skip to content

fix: make every editor preference take effect and save it as soon as it changes - #20

Merged
MotherSphere merged 4 commits into
mainfrom
fix/apply-preferences
Oct 14, 2026
Merged

MotherSphere merged 4 commits into
mainfrom
fix/apply-preferences

Conversation

@MotherSphere

@MotherSphere MotherSphere commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What changed

Most editor preferences in the Settings window were stored in the project but never read, and settings reached the disk only when the Settings window closed. Each preference now either works or is gone, and every change is saved at once.

Every project setting and its fate

Field Fate
editor_font Wired: sets the editor font. "monospace" keeps the bundled JetBrains Mono, "serif" and "sans-serif" use the system families. Applies to the main editor, the split view, focus mode and composition mode.
editor_font_size Wired: editor text size.
editor_zoom Wired: multiplies the text size.
line_spacing Wired: editor line height, as a multiple of the size.
editor_width Wired: width of the text column in the main editor, in percent of the panel.
fullscreen_text_width Wired: width of the text column in composition mode, in percent of the window.
show_word_count Wired: shows or hides the counts in the status bar.
show_synopsis_in_binder Wired: a binder item with a synopsis shows it in a tooltip on hover. The control moves to a "Binder" section.
smart_punctuation Wired: master switch for as-you-type smart punctuation.
auto_correction (new) The curly quote, em dash and ellipsis toggles were app state that reset on every launch and did nothing. They are now a project setting with three fields (smart_quotes, em_dashes, ellipsis), saved like the others, and applied as you type. Double hyphens at the start of a line, after punctuation or after the | of a table row stay as they are, so Markdown rules (---), comments (<!--) and table rules (|---|, | --- |) keep working.
capitalize_sentences, superscript_ordinals (inside the old auto-correction state) Deleted: they had no control and nothing read them, so they are not saved in project.json.
auto_save_seconds, target_word_count, target_deadline, auto_backup, backup_interval_saves, labels, statuses Already read; unchanged.
typewriter_scroll Deleted with its control: iced's text editor gives no control over its scroll position.
show_paragraph_marks Deleted with its control: iced's text editor can only colour text, not draw marks that are not in it.
spell_check_enabled Deleted with its control: there is no as-you-type spell checker, and iced's editor cannot underline. The F7 spell check is unchanged and the Corrections tab now points to it.
default_doc_type Deleted with its control: binder items have no document type for it to set.
auto_numbering Deleted with its control: the compiler has no scene numbering.
fullscreen_bg_color, composition_bg_color Deleted: they had no control and nothing read them.
high_contrast, large_ui, ui_scale, reduce_motion, screen_reader_hints Untouched here: the shared colony-ui preferences replace them in a follow-up. They are still saved when changed.

Smart punctuation is on by default

smart_punctuation and the three substitutions default to on, and projects saved by older versions already carry smart_punctuation: true, so every existing project now gets curly quotes, em dashes and ellipses as you type. A Backspace right after a correction puts back the characters you typed (", ', --, ...), so a literal straight quote or double hyphen takes one extra key. The README says so.

Saving

  • Every message that changes a setting (title, targets, autosave, appearance, corrections, backup, accessibility) saves right away; closing the Settings window no longer has to.
  • The save writes only the title and settings into the existing project.json, through the same atomic write as a full save. It does not rewrite every document on each keystroke in a settings field, and it never records binder entries whose documents are not on disk yet. A project that was never saved keeps its settings until its first save, as before.
  • Project files written by older versions load unchanged: removed fields are ignored and new ones take their defaults, including each field of auto_correction.

Also in this PR

How it was verified

  • New tests: each wired field changes what it claims (text look, column width, status bar counts, synopsis tooltip, as-you-type corrections through the editor and their toggles, spaced table rules left alone, Backspace right after a correction restoring the typed characters and only then); a settings change is on disk while the window stays open; save_settings leaves unsaved binder entries out; a project.json with every removed field and no auto_correction still loads.
  • cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings pass locally, as do the targeted tests. CI runs the full matrix.

BEGIN_COMMIT_OVERRIDE
fix: make every editor preference take effect and save it as soon as it changes
fix: start normally when a command-line argument is not valid UTF-8
END_COMMIT_OVERRIDE

The --version check read argv with std::env::args(), which panics on an
argument that is not valid Unicode, so a file manager passing a Latin-1
path aborted Avalon at startup. Read argv as OsString instead. Also
replace an em dash in a Cargo.toml comment.
…it changes

Most editor preferences were stored but never read, and settings were only
written when the Settings window closed.

- The editor font, size, zoom and line spacing now set the text in the
  main editor, split view, focus mode and composition mode. The editor
  width and the composition text width set the text column width.
- Smart punctuation applies curly quotes, em dashes and ellipses as you
  type. Its substitution toggles are now project settings, so they are
  saved too.
- "Word count in status bar" shows or hides the counts, and "Show
  synopses in binder" shows a synopsis tooltip on binder items.
- Removed the controls that could not work: typewriter scrolling,
  paragraph marks, as-you-type spell check, default document type and
  scene auto-numbering, plus the unused composition colours. Older
  project files that still carry them load as before.
- Each settings change writes the title and settings into project.json
  at once, without rewriting the documents.
- Recording an insertion no longer panics when the stale cursor range
  falls inside a multi-byte character.
Double hyphens after the | of a table row, as in | --- |, no longer turn
into an em dash. A Backspace right after a smart punctuation correction
puts back the characters it replaced. AutoCorrection loads with serde
defaults and drops capitalize_sentences and superscript_ordinals, which
nothing read.
@MotherSphere
MotherSphere merged commit 61de864 into main Oct 14, 2026
7 checks passed
@MotherSphere
MotherSphere deleted the fix/apply-preferences branch October 14, 2026 11:57
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