Bug 150589 - Deleting a drawing object kicks you back to the last position of the text cursor instead of the anchor. Ctrl-X does not.
Summary: Deleting a drawing object kicks you back to the last position of the text cur...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.6.2 release
Hardware: All All
: medium normal
Assignee: Jim Raykowski
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks: Anchor-and-Text-Wrap Writer-View-Jumps
  Show dependency treegraph
 
Reported: 2022-08-24 23:18 UTC by Dan
Modified: 2022-09-17 19:52 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
A document that can demonstrate the problem (123.49 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-08-24 23:21 UTC, Dan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan 2022-08-24 23:18:17 UTC
Description:
I OCRed a document and each page has a header and footer graphic. When I delete them, I end up back at the beginning of the page. On one-hundred plus documents, that is a real pain. If I Ctrl-X, I at least stay on the same page so I can continue editing.

Steps to Reproduce:
1.I attached a sample document.
2.Go to page 21 and delete the thin graphic at the top or bottom
3.Go to the next page and try Ctrl-X

Actual Results:
Delete jumps you to the beginning of the document

Expected Results:
Delete should leave you on the same page, not jump to the beginning.


Reproducible: Always


User Profile Reset: No



Additional Info:
I have a sample file for you to play with - others on the forum easily verified the problem.
Comment 1 Dan 2022-08-24 23:21:41 UTC
Created attachment 182002 [details]
A document that can demonstrate the problem

This is one of several documents I have been making over the last couple of weeks. All exhibit the same delete, jump to the beginning of the file action. I only recently discovered by accident that Ctrl-X does not.

The file was made with Omnipage Professional 18.
Comment 2 Stéphane Guillou (stragu) 2022-08-26 22:04:40 UTC
I couldn't reproduce with:

Version: 7.2.7.2 / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

or:

Version: 7.3.5.2 / LibreOffice Community
Build ID: 184fe81b8c8c30d8b5082578aee2fed2ea847c01
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

or:

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 24087697d5cf78aac346d4dcea0596373e15a95c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

... except if I leave my cursor at the beginning of the document. Dan, where is your cursor when you delete the image? The view should jump back to wherever your cursor is.

Please also try updating to the latest version of LibreOffice 7.3 to see if you have the same issue: https://www.libreoffice.org/download/download-libreoffice/
Comment 3 Stéphane Guillou (stragu) 2022-08-29 16:03:21 UTC
Dan emailed me directly with a response:

> As requested, I upgraded to the 7.3.5.2 version and the problem remains. Note: it is not 100%, never has been, but I have edited hundreds of pages over the last few months and never found a pattern as to why it fails or not.

> On the test document: I went to page 22 and the top graphic deleted with no problems. The bottom graphic kicked me to the beginning of the document. On page 24, it was opposite. The deleting the top graphic kicked me to the beginning of the document and the bottom one did not.

> I was very careful to select the graphic, not move the cursor and then hit delete.

OK, I think I can attempt to clarify the steps here:

0. Open document, wait for it to load completely
1. Don't click anywhere in the text; open the Navigator sidebar and double-click on Image13 (in the "Drawing objects" section)
2. Press "Delete" on the keyboard
3. Repeat with another drawing object, but use Ctrl + X to cut it.

Actual results:

Viewport jumps back to the top of the document (the last position of the text cursor) when deleted but stays put when cutting.

Expected result:

When deleting the drawing object, the text cursor is placed at its anchor (and the viewport only moves if it is not visible).

I get the same result with all other drawing objects.

Note that I also see this with version 6.3 so I don't think it is a regression, it might have always been like that.

Version: 6.3.6.2
Build ID: 2196df99b074d8a661f4036fca8fa0cbfa33a497
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); UI-Language: en-US
Calc: threaded

This is not specific to DOCX, the same document saved as ODT shows the same behaviour.
Dan, could you please test these steps and confirm that it behaves as decribed?
Comment 4 V Stuart Foote 2022-08-29 16:24:53 UTC
and after the <Ctrl>+X cut, what happens if you start typing text?

Ewww, that's annoying. The text cursor correctly lands at the spot where the cut frame had been, but it jumps to top of document when any frame is just deleted.

And it seems a little unreliable, sometimes cursor will land there with a deletion.

Affecting work in both Sidebar Navigator and with mouse click-selection.

@Jim, here's one you might have fun with.
Comment 5 Jim Raykowski 2022-09-15 20:24:27 UTC
The Ctrl-X observation was very helpful! Here is a patch that makes the cursor position behave like Cut for Delete and Backspace:
https://gerrit.libreoffice.org/c/core/+/140036
Comment 6 Commit Notification 2022-09-16 20:08:39 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dced115279b953735040663f71a2e848762672d7

tdf#150589 Set cursor to better position after deleting a drawing

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Stéphane Guillou (stragu) 2022-09-17 19:52:18 UTC
I can verify it as fixed in:

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 3752e8eaa81a50b018669d03dc59b3753a5248ef
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thank you Jim!