Created attachment 115038 [details] example document with macro --> can be used for reproducing the problem In current LO 4.4 version and in master I noticed that calling setString on the text range of a bookmark looses the bookmark. This did not happen until at least LibreOffice 4.1.6 - so the behaviour has incompatibly changed somewhere inbetween --> regression! The bookmark must be kept if its text content is changed. This code shows, what I mean: Sub Main bm = ThisComponent.Bookmarks.getByName("bookmark") range = bm.Anchor.Text.createTextCursorByRange(bm.Anchor) range.setString("now, there is no more bookmark :-(") End Sub Here is how to reproduce: Open the attached document "setStringOnBookmarkLoosesBookmarkExample.odt" (enable macro-execution) and follow the instructions in the document. The practical meaning: Munich's WollMux (www.wollmux.net) heavily uses Bookmarks as DocumentCommands. This bug direclty affects WollMux which can no longer be run with these LO versions.
This bug is caused by git commit http://cgit.freedesktop.org/libreoffice/core/commit/?id=370febbf19a5f362394d1c9e69b12dcb218f6501 mst: what do you think about this?
confirmed Version: 5.0.0.0.alpha1+ Build ID: badec7478035008f514e0976a94438fe2e32dc40 TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-04-22_01:28:24 works in LibreOffice 3.5.0 Build ID: d6cde02
*** Bug 90829 has been marked as a duplicate of this bug. ***
DelCntntIndex will save the bookmarks and delete those that have both pos. inside the range but not those with only one pos. inside the range _DelBookmarks will not save the bookmarks, delete those that have both pos. inside the range and adjust the position of those with one pos. inside the range. DelCntntIndex handles bookmarks that exactly match both start and end position *differently* than _DelBookmarks - so DelCntntIndex will not save them and _DelBookmarks then deletes them. what a mess... (didn't Bjoern want to refactor all of this bookmark stuff just a few years ago?) fixed on master
Michael Stahl committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=c7fb1d8334d2289906ac2a0a8c32946493d10e00 tdf#90816: sw: fix bookmark loss in SwUndoDelete It will be available in 5.0.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.
Michael Stahl committed a patch related to this issue. It has been pushed to "libreoffice-4-4": http://cgit.freedesktop.org/libreoffice/core/commit/?id=d70174ef1bc5894fe3cd46d4bda1dfd5f6422d39&h=libreoffice-4-4 tdf#90816: sw: fix bookmark loss in SwUndoDelete It will be available in 4.4.4. 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.
(In reply to Michael Stahl from comment #4) > what a mess... > > (didn't Bjoern want to refactor all of this bookmark stuff just a few years > ago?) Yes, and I had sw/qa/complex/writer/CheckBookmarks.java around to ensure to reproduce bug-for-bug compatibility back then for the most part -- as we used prefer than back in those days. Beyond that: Ranting about a refactoring that made bookmarks somewhat more maintainable in OOo 3.2(?) in a regression vs. LibreOffice 4.1 seems somewhat uncalled for.
Migrating Whiteboard tags to Keywords: (bibisected) [NinjaEdit]