Bug 112740 - FILESAVE: DOCX - Save cursor position
Summary: FILESAVE: DOCX - Save cursor position
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 129167 (view as bug list)
Depends on: 112742
Blocks: DOCX Bookmarks Saved-Cursor
  Show dependency treegraph
 
Reported: 2017-09-29 07:41 UTC by Yousuf Philips (jay) (retired)
Modified: 2022-06-25 15:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2017-09-29 07:41:38 UTC
The cursor position can be saved into OOXML by adding a bookmark at its location, so that when the document is reopened it jumps back to that location. This is how the XML looks from a .docx file generated by MS Word.

<w:p>
 <w:bookmarkStart w:id="0" w:name="_GoBack" />
 <w:bookmarkEnd w:id="0" />
</w:p>
Comment 1 Buovjaga 2017-10-29 19:34:54 UTC
Sounds good -> NEW
Comment 2 Timur 2019-12-11 11:35:18 UTC
*** Bug 129167 has been marked as a duplicate of this bug. ***
Comment 3 Justin L 2022-06-22 20:27:15 UTC
Of course, care needs to be taken to delete any existing _GoBack bookmarks while doing this. And of course no point in saving this if LO can't read it back first.

See bug 112742 comment 3 for info on how ODT imports this info. Exporting is likely done via xmloff/source/core/xmlexp.cxx ImplExportStyles.

Exporting ViewSettings in DOCX is docxexport WriteSettings().
Comment 4 Roland Hughes 2022-06-23 01:29:48 UTC
(In reply to Justin L from comment #3)
> Of course, care needs to be taken to delete any existing _GoBack bookmarks
> while doing this. And of course no point in saving this if LO can't read it
> back first.
> 
> See bug 112742 comment 3 for info on how ODT imports this info. Exporting is
> likely done via xmloff/source/core/xmlexp.cxx ImplExportStyles.
> 
> Exporting ViewSettings in DOCX is docxexport WriteSettings().

The point I was making in the other bug marked as duplicate of this one is that I don't believe the last position was ever saved in the document. The reason for this belief is I use a lot of machines between my office and home. Store many/most of my important documents on a NAS. At least the important ones I'm currently working on. I fill in all of the contact information for LO in my account on each machine. 

Back when this worked for both, it didn't work across machines. 

If I spent the day in my office editing something and saved it before going in for supper then opened the same document on the same NAS with my laptop from within the house, it didn't go back to the same line on my laptop. If my laptop had opened it before, then it went back to the same line the laptop remembered.

This operated as if the document and last position were being stored in an INI/Settings type file specific to each user on each machine. There as probably some failure to clean up (how could LO ever know you were really done?) which lead to some kind of size/performance issue parsing that file(s).

Were I to guess, that would be my guess. It is based on behavior I observed. Were it stored in the document I would have always returned to the last position no matter which machine.

Storing in the document also opens up a major can of worms.

Fred spends the morning working on pages 123-152. He saves the document with is cursor in the middle of page 151.

Sally spend a couple of hours after lunch working in the same document file on the same NAS. Her edits are in the page range of 41-54. She exits and saves with cursor in first position of page 54.

Jill spends a couple of hours working on the document in the evening using the exact same file on the exact same NAS. She started adding pages at 184 and got on a roll. The document is now 248 pages long. When she saves and exits the cursor is in the dead last position of the file.

Which one wins?

If you are storing the file and last position locally per user in a Settings/INI/etc. file, the feature behaves __exactly__ as each user expects. When they open the file up the cursor goes right back to their personal last known position.

If you store it as a bookmark in the file, last one in wins and two other users file bug reports about last position being broken.
Comment 5 Justin L 2022-06-25 02:17:20 UTC
an idea presented here: https://gerrit.libreoffice.org/c/core/+/136408/1
Comment 6 Roland Hughes 2022-06-25 07:09:28 UTC
(In reply to Justin L from comment #5)
> an idea presented here: https://gerrit.libreoffice.org/c/core/+/136408/1

See comment 4. Your idea completely ignores the reality that today the same file is edited by multiple people.

Saving of last position should not be tied to a document file itself, no matter what format. It needs to be stored in a settings/ini file on a per document per user basis. It needs to only kick in __after__ a document is fully loaded so it must be based on whatever internal data format is being used by LO.
Comment 7 Justin L 2022-06-25 15:37:33 UTC
The _GoBack bookmark seems to be abandoned by MS Word, so it seems best to me to WONTFIX.

Also, one downside to bookmarks in LO is that "View - Field Shadings" shows a thin gray shade at the bookmark - which might alarm users if we start exporting this bookmark.

P.S. It IS valid to store _GoBack as a "selection" - MS Word did that too. And Shift-F5 did re-select it as well (dangerous as that seems...).