Skip to content

Edit text: space between paragraphs - #1925

Open
regendorf-ux wants to merge 11 commits into
storytold:mainfrom
regendorf-ux:pr/paragraph-spacing
Open

regendorf-ux wants to merge 11 commits into
storytold:mainfrom
regendorf-ux:pr/paragraph-spacing

Conversation

@regendorf-ux

@regendorf-ux regendorf-ux commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

edit.line-paragraph-spacing was partial: line spacing existed, the space between paragraphs did
not. Now a line break in the edited text starts a paragraph, and the paragraphs are set apart:

  • BlockStyle.paragraph_spacing: Option<f64> (points, beyond the line spacing). rewrite_block
    splits the text at line breaks, wraps and justifies each paragraph on its own (the last line of
    each paragraph is never stretched), and steps down by the line spacing plus the gap before a
    paragraph's first line; underlines follow. None is half the font size when the text has
    several paragraphs, so a plain Enter already reads as a paragraph; a non-finite value is refused.
  • The row-model rewrite (text_regions) keeps the rows a line break started apart from wrapped
    ones: the gap goes before those, and a row the page already had sits where it was, shifted by
    the spacing added above it.
  • Format text panel: a Paragraph spacing field (points) next to the line spacing; the tool
    text_edit takes paragraph_spacing.
  • Rows for the two labels in all 21 languages; parity/acrobat-features.toml
    edit.line-paragraph-spacing → shipped (notes: space before and after as separate values are
    still missing).

How you verified it

Re-run on 2026-10-15 after merging main into the branch (41809cf, then afa8e18). The merge needed the language catalogs (upstream's rows and this PR's kept), ATTRIBUTION.toml's checksums and the tests both sides had appended at the same place; the new Vietnamese catalog got this PR's 2 labels (written by an AI model, like the other languages' rows, so a native speaker's review is welcome). Reconciled with #1486 (line breaks kept when editing a multi-line paragraph): the default gap between paragraphs applies to upright text only; turned text keeps its rows where they were unless a spacing is set. #1539 merged without conflict. A needless borrow clippy found on Windows is fixed.

Full run on Windows (Rust 1.98) at the branch merged with main 41809cf; after main afa8e18 was merged, re-checked on macOS (this PR's tests, the i18n tests, cargo clippy --all-targets -- -D warnings on the changed crates and their dependents (automation, edit, engine, ui-egui, audit, redact, the apps), cargo xtask assets):

  • cargo fmt --all --check, cargo xtask assets, cargo xtask layers, doctests: exit 0
  • cargo clippy --workspace --all-targets -- -D warnings: clean on Windows; on macOS the only warnings are main's own (crates/ui-egui/tests/view.rs: two helpers used only by a non-macOS test)
  • This PR's tests pass: paragraph_breaks_get_their_own_spacing, the_format_panel_has_a_paragraph_spacing_field, and main's turned_paragraph_keeps_its_line_breaks_when_a_word_is_added
  • cargo nextest run --workspace: 3422 of 3433 passed on Windows. The 11 failures fail the same way on main without this change: the parity file's duplicate keys (also cargo xtask parity; fix(parity): merge the keys concurrent merges left twice in acrobat-features.toml #2419 / M0: repair duplicate feature-parity assignments #2473), the zh-hant duplicates and the Vietnamese coverage tests in i18n (none lists this PR's labels), signing_with_translated_labels_through_tools (Tests: the translated-labels signing test uses an 8-character digital ID password #2429), canvas::tests::explicit_search_jumps_record_history_and_keep_match_destination, view::single_page_swipe_that_reaches_the_edge_does_not_turn_but_a_fresh_one_does, editing::files_dropped_beside_the_pages_panel_still_open_as_documents (intermittent)

Tests. paragraph_breaks_get_their_own_spacing (edit): a one-line source rewritten as
"First one\nSecond one" gets the row step alone (15 pt for a 10 pt one-liner), 35 pt with a 20 pt
spacing, 15 pt with 0, and a wrapped single paragraph keeps the ordinary 12 pt step.
the_format_panel_has_a_paragraph_spacing_field (ui-egui): the field is in the panel while a
paragraph is being edited.

Anything a reviewer should look at first

  • The labels in the 20 non-English language files were written by an AI model from the English
    wording; a native speaker's review of those rows would be welcome.
  • Justification now stops at each paragraph's last line (before, only the block's last line was
    left unstretched); with a single paragraph nothing changes.
  • Overlap with M7: line and paragraph spacing #1487 ("M7: line and paragraph spacing", opened the day before this one): it adds the
    same BlockStyle.paragraph_spacing, a spacing field in the Format panel and the text_edit argument.
    On top of that, this PR stops justification at each paragraph's last line, adds a UI test beside the
    edit-crate test, and carries the label in all 21 catalogs. Whichever you prefer is fine: if M7: line and paragraph spacing #1487
    lands first I'll rebase this down to what it adds on top of it, or close it.
  • Fits M7: lay out Format text as Acrobat's panel #2249 ("lay out Format text as Acrobat's panel"): that redesign shows paragraph spacing
    disabled as Planned and replaces edit_text_ui::extras_panel, where this PR's field lives. This PR
    supplies what the control would drive (BlockStyle.paragraph_spacing applied by text_regions.rs);
    if M7: lay out Format text as Acrobat's panel #2249 lands first I'll move the field into its panel and enable it there.

Never-crash

  • No new unwrap/expect/panic! outside tests
  • The spacing is validated (finite, clamped to 0–14 400 pt); rows are indexed with get
  • No unsafe

Provenance

  • No asset added; no code from another implementation

Security

  • No network access

Parity and reach

  • parity/acrobat-features.toml updated with what is still missing

  • Headless through text_edit (paragraph_spacing)

  • No documented behaviour changed (docs/ has no entry for it)

  • Merged with main dc41044 (2026-10-15): i18n: fill Vietnamese and Lithuanian coverage gaps on main #2510's Vietnamese and Lithuanian catalogs added rows beside this branch's in vi.tsv and lt.tsv (and ATTRIBUTION.toml's sha256 lines), nothing else. Main's rows kept, this branch's rows main lacks after them, hashes recomputed. Re-checked after the merge: cargo xtask assets ok, i18n::tests 117/117.

  • Merged with main 5fdd820 (2026-10-15): fix(ui): validated signature display, snapshot tab reuse #1895's catalog rows conflicted with this branch's in es.tsv and vi.tsv (and ATTRIBUTION.toml's sha256 lines), nothing else. Main's rows kept, this branch's rows main lacks after them, hashes recomputed. Re-checked after the merge: cargo xtask assets ok, clippy -D warnings on this branch's crates ok, i18n::tests 117/117.

  • Merged with main bc7a12b (2026-10-17): only the translation catalogs' new rows and ATTRIBUTION.toml's hashes met this branch (both sides kept, hashes recomputed). Re-checked on macOS: cargo check --workspace --all-targets, cargo xtask assets, i18n::tests 115/115.

  • Merged with main 3f5a784 (2026-10-17): tests and docs both sides added kept (upstream's first), translation rows and ATTRIBUTION.toml's hashes by key. Re-checked on macOS: cargo check --workspace --all-targets, cargo xtask assets, i18n::tests 115/115.

🤖 Generated with Claude Code

regendorf-ux and others added 11 commits October 13, 2026 12:11
A line break in the edited text starts a paragraph; BlockStyle.paragraph_spacing
(points, beyond the line spacing; half the size unless set) goes before each
paragraph's first line. Paragraphs are wrapped and justified on their own, so a
paragraph's last line is never stretched; the row-model rewrite keeps the rows a
line break started apart from wrapped ones and shifts kept rows by the spacing
added above them. A Paragraph spacing field in the Format text panel, text_edit
takes paragraph_spacing, rows in every language, parity
edit.line-paragraph-spacing shipped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cargo xtask assets checks each catalog's sha256; the rows this branch adds
changed the files without updating it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ATTRIBUTION.toml: the 21 language files' sha256 recomputed from the
merged files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: the language catalogs (both sides' rows kept), ATTRIBUTION.toml's checksums
(recomputed from the merged files), and tests both sides appended at the same place.
Upstream's new Vietnamese catalog gets this change's labels.
…thuanian catalogs' new rows beside this change's
Conflicts: ATTRIBUTION.toml, crates/ui-egui/src/i18n/es.tsv, crates/ui-egui/src/i18n/vi.tsv. Catalogs keep upstream's rows, then this branch's rows upstream lacks; ATTRIBUTION.toml is upstream's with every sha256 recomputed; progress lines keep both sides, upstream's first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TTRIBUTION hashes by key (ATTRIBUTION.toml )

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed on both sides kept (upstream's first), catalogs and ATTRIBUTION by key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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