Skip to content

Zotero: text typed just after a citation goes outside its field - #1162

Merged
echelon merged 2 commits into
storytold:mainfrom
marcoarnulfo:fix/field-end-caret-typing
Oct 14, 2026
Merged

echelon merged 2 commits into
storytold:mainfrom
marcoarnulfo:fix/field-end-caret-typing

Conversation

@marcoarnulfo

Copy link
Copy Markdown
Contributor

Fixes #898.

A range field's end marker takes no room, so a click just after a citation puts the caret before it: whatever you typed there went into the citation's result, Zotero then saw the citation as edited by hand, and asked to replace it when you added another citation or the bibliography (it reported the caret as inside the field). Right after inserting a citation it worked only because the bridge leaves the caret after the marker. Now a collapsed caret sitting on one or more field ends is moved past them (Document::past_field_ends) before typing/pasting, before Zotero inserts a field, and when Zotero asks whether the cursor is in a field, which matches Word, where text typed right after a field lands outside it. The arrow-key step over the invisible marker the reporter noticed is unchanged; happy to look at that separately if you'd like.

Validation:

  • tests_typing::typing_after_a_citation_goes_outside_its_field (clicks just after the citation through the layout, then types): fails on main (field result becomes (Smith 2020). Dogs bark.), passes here
  • zotero tests::a_citation_added_just_after_another_is_not_nested_in_it: fails on main (Document_cursorInField returns the first citation), passes here
  • cargo test -p wordcraft-engine --lib tests_typing::, cmd::fields, cmd::citations, cmd::controls, cmd::speech; cargo test -p wordcraft-zotero --lib tests::
  • cargo clippy -p wordcraft-doc -p wordcraft-engine -p wordcraft-zotero --all-targets -- -D warnings, cargo fmt --all -- --check
  • (macOS, Apple silicon)

@echelon
echelon merged commit 7d3767b into storytold:main Oct 14, 2026
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution, @marcoarnulfo! This has landed in main. If you haven't already, come join us on Discord: https://discord.gg/artcraft

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.

Zotero citation fields buggy (not closed) when introduced at the end of a document and typing afterwards

2 participants