Repository navigation
Field codes: show, edit, update, unlink, lock and step through fields like Word - #349
Merged
Merged
Conversation
vangel76
force-pushed
the
feat/339-field-codes
branch
3 times, most recently
from
October 10, 2026 22:02
3243236 to
f82e414
Compare
Contributor
Author
|
Rebased onto main after #335 (Columns, Symbol and Field dialogs) merged. Behaviour change: |
vangel76
force-pushed
the
feat/339-field-codes
branch
from
October 10, 2026 23:15
f82e414 to
fc61600
Compare
Contributor
Author
vangel76
force-pushed
the
feat/339-field-codes
branch
2 times, most recently
from
October 10, 2026 23:58
cfba122 to
7cc3f1c
Compare
Show field codes instead of results with View > Field Codes (Alt+F9) or
per field with Toggle Field Codes (Shift+F9); a field showing its code is
drawn as { CODE } on light grey. Edit a field's code in a small popup
(double-click a field showing its code, right-click > Edit Field..., or
fields.setCode), and Ctrl+F9 asks for a new field's code. F9 updates
fields and shows the selected ones' results again.
New commands: fields.unlink (Ctrl+Shift+F9) replaces fields with their
text, fields.lock / fields.unlock (Ctrl+F11 / Ctrl+Shift+F11) keep a
result through updates (already saved as w:fldLock), fields.next /
fields.previous (F11 / Shift+F11) select the next or previous field, and
fields.selected reports the fields in the selection. Range fields
(citations) can be locked, unlinked, edited and stepped through too.
The right-click menu gains Update Field, Edit Field... and Toggle Field
Codes when the selection holds a field. Strings are translated in every
catalog; parity catalog, ui-parity, gaps and roadmap updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vangel76
force-pushed
the
feat/339-field-codes
branch
from
October 11, 2026 08:05
7cc3f1c to
45d34ad
Compare
# Conflicts: # ROADMAP.md # crates/ui-egui/src/i18n/et.tsv # docs/gaps.md # docs/ui-parity.md
Member
|
Thanks for the contribution, @vangel76! This is now merged into main. If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
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.
What changed
Word's set of field tools, everything as commands:
view.fieldCodes {"value"?: bool}(Alt+F9) shows every field's code in place of its result, as{ PAGE }on light grey, like Word's field shading.fields.toggleCode(Shift+F9) switches only the field(s) in the selection. The per-field toggle is a flag on the field (code). It is undoable, never written to files and left out of saved JSON when off.fields.setCode {"code"}. It sets the instruction and updates fields so the result follows. The popup opens when you double-click a field that shows its code, choose right-click › Edit Field…, or runfields.setCodefrom the UI without a code. Scripts and agents get an error, never a dialog. I picked this over true inline editing: it needs no new caret or selection model inside an object, and it works the same for every field type.insert.fieldwithoutinstr) opens Columns, Symbol and Field dialogs #335's Field dialog (now on main), whose Field Codes view takes a typed code. Word inserts an empty{ }and puts the caret inside, which our object model can't do yet.references.updateFields) updates fields as before. The selected fields that were showing their code now show their result again.fields.unlink(Ctrl+Shift+F9) replaces the selected fields with their current text in one undoable step. PAGE/NUMPAGES take their value from the current layout. A range field (e.g. a Zotero citation) loses its markers and keeps its content.fields.lock/fields.unlock(Ctrl+F11 / Ctrl+Shift+F11) set the field'slockedflag, and updates skip locked fields. This already round-trips to DOCX asw:fldLockonw:fldChar/w:fldSimple(reader and writer checked, covered by the existing roundtrip test).fields.next/fields.previous(F11 / Shift+F11) select the next or previous field and wrap around.fields.selectedis a read-only command that lists the fields in the selection (instruction, locked, range, code), so agents can inspect them.keys.rs) and also works when the canvas isn't focused.docs/ui-parity.md,docs/gaps.mdandROADMAP.mdare updated.Limitation: range fields (citation
ADDINfields) keep showing their result in code view. Lock, unlock, unlink, edit code and next/previous do work on them.Shortcuts
view.fieldCodesfields.toggleCodereferences.updateFieldsinsert.fieldfields.unlinkfields.lockfields.unlockfields.next/fields.previousNote for #338 (keyboard shortcuts): that PR lists Shift+F9, Alt+F9, Ctrl+Shift+F9 and F11 as "skipped — no command yet". These commands now exist, so whichever PR merges second should drop them from that list. Both PRs add a key to
key_nameinkeys.rs(F11 here, F2/F4 there), which may cause a small merge conflict.Testing
cmd::fields::tests::field_codes_show_in_place_of_results: Alt+F9 draws{ AUTHOR }/{ TITLE }in place of the results; Shift+F9 flips only the selected field; F9 shows the result again; undo of the toggle.cmd::fields::tests::edit_lock_unlink_and_walk_fields: F11/Shift+F11 walk the fields and wrap;setCodechanges the instruction and the result; a locked field keeps its result through an update and an unlocked one changes; unlink turns the field into text and Undo brings it back; with no field selected the commands return an error and add no undo step.ui-eguifield_code_dialogs_open_for_users_only: Ctrl+F9 opens the Field dialog; Edit Field opens the popup prefilled with the selected field's code; programmatic calls error without a dialog.cargo testpasses for doc, layout, docx, docbin, pdf, engine (includinghostile_params_never_panic) and ui-egui.cargo clippy --all-targets -D warningspasses on those crates,cargo fmtis clean, andcargo xtask layers,assets,wasmandparityall pass.ui_shot: with Alt+F9, "Page { PAGE } of { NUMPAGES }, written on { DATE @ "MMMM d, yyyy" }" draws on grey shading.Fixes #339
🤖 Generated with Claude Code