Cross-Reference to Heading Text of Heading generates Error! Reference source not found. after source text is updated
Responding here, because this page seems to come up in google if you search for certain bookmark and cross-reference problems, specifically the "last character gets lost when I edit bookmarks" issue. I found a slightly ugly but usable workaround that may work in certain projects.
In my case, the project is: I have user-editable text on a label, an 8-digit number. Whatever number they type, I want to be duplicated as a barcode below the number.
To make this work, I highlighted the user-editable text, inserted a bookmark... then typed out the barcode (using a font like Free3of9), highlighted it, and created a cross reference to the 8-digit number. So the barcode number should now match whatever the user types.
(aside: To preserve the barcode font, you can right click the cross reference, edit field, go to field code at the bottom left, and then add the switches \h * charformat)
Anyway, to address the main problem: If a user highlights the last digit of the number and retypes it, the bookmark shortens by 1 digit, because you don't really "replace" the number, you technically delete it for a split second, then add a new number, which is always inserted AFTER the end of the bookmark.
To prevent this, I add a special character at the end of the number. The special character is included in the bookmark. I think it's unicode 200B, zero-width space. you can copy it on emptycharacter.com and then paste it into word. It's invisible, but you may see some things slightly shift vertically. This special character works because it meets several needs:
• It's invisible and zero width, so even though the barcode text duplicates it, the barcode remains scannable.
• If other barcode stuff needs to appear after the editable number, it won't be affected.
• If you double click the number, the empty character isn't automatically included, so you can replace the number without screwing up the bookmark.
• If you need to update just the last digit or two, and highlight them, the hidden character won't be automatically highlighted, (maybe it will if you have that word option set, where partially selecting a word automatically grabs the entire word. But I disable that option)
Anyway, it solved the problem for me, I can edit the bookmark without losing the last character, and to the end user, the fix is invisible.