feat(document): write the seven text properties onto a run of an odf file - #895
Merged
Conversation
This was referenced Sep 13, 2026
Base automatically changed from
fix/text-decoration-one-declaration
to
main
September 13, 2026 16:27
…file
`Text::set_style` states the set fields of a `TextStyle` on one run, and the
edit envelope carries it as `setTextStyle {id, style}`. A set field is
written, never removed; `background_color` with alpha 0 removes a highlight.
A run shares its `text:span` with its siblings, so the odf engine cuts the
span around it (`TreeEditor::isolate`) or wraps a bare run in a new one, and
points it at a fresh automatic style: a copy of the span's automatic style
plus the delta, or a child of its named style. The hook defaults to
`UnsupportedOperation`, so the other engines refuse it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137vd79NGaB8nfLsdPoghM4
andiwand
force-pushed
the
feat/set-text-style-odf
branch
from
September 13, 2026 16:33
8841122 to
91c0702
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Step 2 of the inline formatting plan (
docs/design/document-editing.md, decisions 8 to 12). Rebased onto main after #893 and #894 merged.API.
Text::set_style(const TextStyle &)states the set fields on one run and leaves the rest. A set field is written, never removed, so bold off over a bold paragraph style stays off. Abackground_colorwith alpha 0 removes a highlight.font_name,font_shadowandfont_positionrefuse withUnsupportedOperation. The hookTextAdapter::text_set_styledefaults toUnsupportedOperation, so every engine but odf refuses it.Op.
setTextStyle {id, style}, one run per op. A toggle is a bool, a colour is#rrggbb,highlight: nullis none,sizeis a length with a fixed size (pt,px,in,cm,mm,pc). Anything else refuses. The envelope stays at version 2.{"op": "setTextStyle", "id": 41, "style": {"bold": true, "highlight": null, "size": "14pt"}}odf. A run shares its
text:spanwith its siblings, soTreeEditor::isolatecuts the span before and after it, each part keeping the span's shell; a run outside a span is wrapped in a new one. The span then points at a fresh automatic styleT<n>(StyleRegistry::create_text_style): a copy of the cut span's automatic style plus the delta, a child of its named style, or the delta alone for a new span. An automatic style is never written into, because it may be shared. The new style joins the registry's index.Verified. 13 new
DocumentEdittests over inline fixtures: bare run, run alone in its span, shared automatic style, named style, off over a bold paragraph, all seven properties,highlight: null, two ops on one run, the split-then-mark shape the browser emits, save and reload, the refusals. Headless LibreOffice reopens an editedabout.odtand its docx export carries every property on the marked run.