[Libreoffice-bugs] [Bug 141586] New: Restoring last document position is unreliable

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Apr 9 13:12:48 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=141586

            Bug ID: 141586
           Summary: Restoring last document position is unreliable
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: mikekaganski at hotmail.com
            Blocks: 116376

Writer has always had a feature of (optionally) restore last edited position on
ODT reopen. Since OOo version 2.0, it restores it for the author of last edits
[1]. The logic/data for restoring the position is unchanged since the beginning
[2], and is implemented in SwView::ReadUserDataSequence
(sw/source/uibase/uiview/view.cxx) by reading ViewLeft and ViewTop from ODT's
settings.xml, and calling SwCursorShell::SetCursor to navigate to that point.

The mentioned values are defined as coordinates related to application window,
as shown in the steps below. This makes the restoration of the position
error-prone, dependent on application window size, multi-page view, ongoing
e-layout, etc.

Steps:

0. Make sure to enter some information into Options->LibreOffice->User Data
(First/last name);
1. Open attachment 169498 from bug 140147, make sure to set zoom to 150,
single-page view (controls at the right of the status bar), maximize Writer, go
to end of the document (Ctrl+End), add a space and save.
2. File->Reload
  => this makes the cursor be placed at the correct paragraph (the one starting
with 16 "6"), but at the start of it instead of at the end where the actual
last edit was.
3. Restore Writer window (un-maximize) so that the page does not fit
horizontally into the window (horizontal scrollbar appears at the bottom),
File->Reload
  => this makes the cursor to be at some non-starting position of the same last
paragraph (depends on size of the Writer window, ultimately it appears at the
last position of the last paragraph).
4. Select "Multiple-page view" and zoom out to fit two pages in the Writer
window, File->Reload
  => this fails to restore the position completely, making cursor appear in
front of the first document's paragraph.

Using "Go to last position" function (Shift+F5) restores the position on the
steps #2 and #3, but not on the step #4.

There are multiple problems reported about unreliable work of the feature (see
e.g. bug 140147; multiple questions on Ask mention breakages around v.4.2, and
also misbehavior in different other versions) even for people who made sure to
have user information properly set. Also the spec [2] mentions that even prior
to OOo 2.0, there were similar problems (see opinion of ES in section 8.0.1
line 153):

> I already see bugs related to "sometimes document does not open the same..."

On the other hand, see how the last position is implemented in DOCX. tdf#112740
describes the markup that inserts a special bookmark right into the related
paragraph (word/document.xml):

> <w:p>
>  <w:bookmarkStart w:id="0" w:name="_GoBack" />
>  <w:bookmarkEnd w:id="0" />
> </w:p>

which obviously makes the position unambiguous, not dependent on any unrelated
environment details or concurrency problems.

We could possibly use some existing mechanism (bookmark with a special name?),
or introduce an extension, to also store the position in the document flow in
content.xml (additionally to backward-compatible view information in
settings.xml), and use that when exists.

Note that we currently import the Word's "_GoBack", which is shown in the
Navigator; I suppose that having an own bookmark of that kind (or even of the
same name) would not hurt.

[1] https://bz.apache.org/ooo/show_bug.cgi?id=43146
[2]
http://specs.openoffice.org/appwide/open_doc_behavior/OpenDocumentBehavior.sxw


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=116376
[Bug 116376] [META] Saved cursor edit position in document bugs and
enhancements
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210409/a63020b8/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list