Bug 106377 - Wrong Behaviour of Undo in Writer With Index Entry
Summary: Wrong Behaviour of Undo in Writer With Index Entry
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: All Linux (All)
: medium normal
Assignee: Michael Stahl
URL:
Whiteboard: target:5.4.0 target:5.3.3
Keywords: bibisected, bisected
Depends on:
Blocks: Undo-Redo
  Show dependency treegraph
 
Reported: 2017-03-07 07:28 UTC by Kevin Suo
Modified: 2017-04-21 08:25 UTC (History)
2 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 Kevin Suo 2017-03-07 07:28:00 UTC
Steps to Reproduce:

1. Type in "Hello World!" in Writer.

2. Put cursor at the beginning of the paragraph (i.e., before "H").

3. Insert > Table of Contents and Index > Index Entry. The default value for "Entry" is displayed as "Hello". 
DO revise it to something else (e.g., "Hellow"). Click OK to close the dialogue.

4. Put cursor at the beginning of the paragraph, then right-click > Index Entry > Remove.

5. Undo until you can not undo.

6. Redo until you can not redo.

--> You get "ello World!!!br0ken!!"

It is noticed that the revision of entry name in step 3 is important. 
* If you do not revise the entry name (i.e., use the default "Hello"), the Index Entry will be set on the world "Hello" and you will see "Hello" has a shadow. In this case, you do not reproduce the bug behaviour in step 6.
* If you revise it to "Hellow", the Index Entry will be set before "H", and no text in the document has shadow. In this case, you will reproduce the bug behaviour.

Version: 5.4.0.0.alpha0+
Build ID: af871d02914c9fc6a08079f67b4af71a198e166a
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; VCL: gtk2; 
Locale: zh-CN (zh_CN.UTF-8); Calc: group
2017-02-27.
Ubuntu 16.04 LTS X64.

Also reproduced in:
Version: 5.3.1.1
Build ID: 72fee18f394a980128dc111963f2eefb05998eeb
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; VCL: gtk2; Layout Engine: new; 
Locale: zh-CN (zh_CN.UTF-8); Calc: group
Comment 1 Kevin Suo 2017-03-07 08:11:13 UTC
Bibsecting using the bibisect-releases repo suggested that the behaviour has changed since libreoffice-4.1.0.0.beta1, although versions before 4.1.0.0.beta1 also behaves wrong.

In versions before 4.1.0.0.beta1  (including the old OpenOffice.org), each roundtrip of step 5 and 6 you will loose one char. (i.e., "Hello World!" > "ello World!" > "llo World" > ...).

In all versions after 4.1.0.0. beta1, you get "ello World!!!br0ken!!" at the end.
Comment 2 Xisco Faulí 2017-03-07 19:48:21 UTC
Confirm in

Version: 5.4.0.0.alpha0+
Build ID: d3676ceeec55a41337ce5e6bc596f4f100d0638e
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Regression introduced by:

author	Michael Stahl <mstahl@redhat.com>	2013-02-18 17:36:45 (GMT)
committer	Michael Stahl <mstahl@redhat.com>	2013-02-18 19:16:07 (GMT)
commit	0295c8a34e39326414c1b98cf4da905802f061b0 (patch)
tree	0595896589edc155fae7775fe586403c59842379
parent	24eae2b75c201292990122e69954072f36b6f218 (diff)
sw: let SwTxtNode::GetTxt() return OUString

Adding Cc: to Michael Stahl
Comment 3 Michael Stahl 2017-03-21 10:37:28 UTC
This is not a regression, can reproduce the bug already in OOo 3.0.1,
it's just that the bug became more visible.

when deleting it from the dialog the wrong undo object is created,
it works for marks with start and end but this one doesn't have an end.

it looks like this problem only affects ToXMarks, the other ones
without end (reference marks, fields, footnotes) apparently
don't have a dialog that can *delete* them.

which raises the question why ToXMarks have a delete button
in the dialog.

fixed on master
Comment 4 Commit Notification 2017-03-21 10:37:57 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=63f7da77985674ddf59bb566bdada9c41893e822

tdf#106377 sw: fix Undo of delete of ToXMark from dialog

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2017-03-29 12:29:52 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=123bb36e7eafde85732b57e84d0377586a0a66d8&h=libreoffice-5-3

tdf#106377 sw: fix Undo of delete of ToXMark from dialog

It will be available in 5.3.3.

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

Affected users are encouraged to test the fix and report feedback.