Bug 142845 - Caret misplaced after Paste+Undo
Summary: Caret misplaced after Paste+Undo
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
6.0.2.1 release
Hardware: All All
: low normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.3.0 target:7.2.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Clipboard
  Show dependency treegraph
 
Reported: 2021-06-14 11:29 UTC by Eyal Rozenberg
Modified: 2021-08-10 19:01 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 Eyal Rozenberg 2021-06-14 11:29:46 UTC
In Impress:

1. Have some plain text in your clipboard (e.g. use a text editor and copy from there). A single word will suffice, say "Hello".
2. In a presentation, create a textbox
3. Edit the textbox text, typing in "world".
4. Place the caret before the "w".
5. Paste. (The caret remains before the "w".)
6. Undo the paste, using Ctrl+Z or the Edit menu.

Expected result: Caret remains before the "w"

Actual result: Caret is now at the end of the line, after the whole "world".
Comment 1 Heiko Tietze 2021-06-29 14:17:34 UTC
Confirming. But I don't see a big impact on usability.
Comment 2 Aron Budea 2021-07-31 04:16:33 UTC
This is a regression from the following commit, bibisected to its 6.0 backport using repo bibisect-linux-64-6.0. Adding CC: to Miklos Vajna.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=f0c25c751cf8e166a84b289746bce6202a40391d
author		Miklos Vajna <vmiklos@collabora.co.uk>	2018-02-16 18:08:46 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2018-02-16 23:44:27 +0100

tdf#115783 sd: fix lost char attributes during in-table copy&paste
Comment 3 Commit Notification 2021-08-10 05:44:45 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

tdf#142845 editeng: don't update selection when formatting before sd paste

It will be available in 7.3.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 4 Commit Notification 2021-08-10 18:13:34 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/04f0cd819066229039203fb36848d907146bbba2

tdf#142845 editeng: don't update selection when formatting before sd paste

It will be available in 7.2.1.

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 5 Eyal Rozenberg 2021-08-10 19:01:01 UTC
(In reply to Commit Notification from comment #4)

A nitpick about coding style:

Personally, instead of lines like:

  pImpEditEngine->SetAttribs(aSel, rSet, /*nSpecial=*/SetAttribsMode::NONE, /*bSetSelection=*/false);

I like to write:

  auto noSpecial = SetAttribsMode::NONE;
  auto dontSetSelection = false;
  pImpEditEngine->SetAttribs(aSel, rSet, noSpecial, dontSetSelection);

and that way I've let the code document itself without needing the two comments. Also, any reasonable compiler will optimize away the two local variables.