Skip to content

memo: add a persistent paragraph first-line indent preference - #66

Merged
htommr merged 1 commit into
text2future:mainfrom
YihongSuo-148:feat/paragraph-first-line-indent
Oct 23, 2026
Merged

htommr merged 1 commit into
text2future:mainfrom
YihongSuo-148:feat/paragraph-first-line-indent

Conversation

@YihongSuo-148

Copy link
Copy Markdown
Contributor

What

Add a First-line indent preference under Preferences → Editor Format, with None (default) and 2 characters (2em) options, a live preview, and reset support.

The setting is persisted through the existing frontend and Rust preferences path. Missing or invalid values fall back to zero without resetting other preferences. Only top-level document body paragraphs receive indentation; headings, lists, blockquotes, code, tables, embedded conversations, and chat inputs retain their existing layout.

Includes English/Chinese labels, regression coverage, and a short user guide in docs/EDITOR-FORMAT.md.

Why

Support conventional Chinese paragraph formatting without inserting whitespace into Markdown. A saved preference lets users apply the same presentation to existing and new paragraphs and retain it after restarting Flowix.

How tested

  • Focused frontend tests: 18 passed across the preference store, font-settings hook, settings UI/preview/reset, and real CSS selector scope.
  • npx tsc --noEmit.
  • npm run build, including the web bundle budget check.
  • Focused Rust preference tests: 3 passed, covering legacy defaults, malformed values, updates, and save/reload.
  • macOS ARM64 native release compilation and separate .app bundling.
  • Manual verification on macOS: selected 2 characters, fully quit and relaunched, confirmed the preference and paragraph indentation persisted, wrapped continuation lines and headings stayed left-aligned, and Markdown content remained unchanged.
  • git diff --cached --check.
  • rustfmt --edition 2021 --check app/flowix-desktop/src/config/user.rs.
  • cargo fmt --manifest-path app/Cargo.toml --all -- --check reports formatting differences in unchanged files; the modified Rust file passes.
  • Full Rust workspace tests and Clippy were not run locally.
  • npm run lint: this checkout does not define a lint script.

Focused test commands:

npm test -- app/flowix-web/features/preferences/store/user-settings-store.test.ts app/flowix-web/features/preferences/hooks/use-apply-font-settings.test.tsx app/flowix-web/features/preferences/sections/format.test.tsx app/flowix-web/styles/editor.test.ts

cargo test --manifest-path app/Cargo.toml --release \
  --target aarch64-apple-darwin -p flowix-desktop --lib \
  --config 'profile.release.package.flowix-desktop.opt-level=0' \
  --config 'profile.release.package.flowix-desktop.codegen-units=16' \
  config::user::tests::first_line_indent

Risks

Disabled by default; existing documents keep their current presentation. This adds a backward-compatible preference field without changing document contents or the database schema.

The full production packaging command exited at bundle_dmg.sh; native compilation and separate .app packaging succeeded. DMG packaging is not claimed as verified.

Persistence across upgrades requires the target release to include this feature; older releases may ignore or drop the preference.

Checklist

  • No secrets, tokens, or .env files touched.
  • No force-push to main.
  • User-facing behavior documented.
  • No database migration required; legacy preferences default to no indentation.

Opened as a draft per the contribution guide while awaiting reviewer assignment.

@htommr
htommr merged commit 56a55d1 into text2future:main Oct 23, 2026
0 of 3 checks passed
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