Bug 151451

Summary: SearchDescriptor returns wrong result when Tracking enabled (macro search finds not-displayed redline text)
Product: LibreOffice Reporter: Jordi <bugs.df.org>
Component: BASICAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: ilmari.lauhakangas, thb
Priority: medium Keywords: bibisected, bisected, regression
Version: 6.2.0.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=147220
https://bugs.documentfoundation.org/show_bug.cgi?id=127635
https://bugs.documentfoundation.org/show_bug.cgi?id=36582
Whiteboard:
Crash report or crash signature: Regression By: Michael Stahl
Bug Depends on:    
Bug Blocks: 83946, 138327    
Attachments: Doc with Sample Text and Macro

Description Jordi 2022-10-10 11:06:32 UTC
Created attachment 182939 [details]
Doc with Sample Text and Macro

SearchDescriptor in macro finds specified regex pattern in overwritten text when Tracking Changes is enabled (but old text not visible). No issue when Tracking is disabled in document.

Tested against the versions of LO I have on my Windows 10 system, 

it does NOT occur on LibreOffice 5.4.7.2 x64
but it DOES on LibreOffice 6.2.0.3 x64


Sample document with macro attached. Simple test macro to exhibit the problem is as follows,

Dim oDoc:oDoc = ThisComponent

Dim sDescriptor
sDescriptor = oDoc.createSearchDescriptor

Dim regx: regx = "[:digit:][:digit:]:[:digit:][:digit:]:[:digit:][:digit:]"

sDescriptor.SearchString = regx
sDescriptor.SearchRegularExpression = True

Dim oVC: oVC = oDoc.CurrentController.getViewCursor()	

dim r, oText
r = oDoc.findnext(oVC.end(),sDescriptor)

oVC.gotoRange(r.end(), false)
Comment 1 Jordi 2022-10-10 11:10:34 UTC
Searching for regex using F&R dialog works correctly.
Comment 2 Buovjaga 2023-02-23 08:49:52 UTC
Bibisected with linux-64-6.2 to 94c1af65367dcbc7272455cf6d4940252a289b62
sw_redlinehide: make layout based Show/Hide mode the default

Bad result is cursor stopping at the indicated spot:
<-- There was a time code here, mustn’t stop here.
Comment 3 Justin L 2023-08-25 17:31:54 UTC
I got an error when running the macro in 24.2.

So I just did Ctrl-H (find replace dialog), turn on regex and searched for [:digit:][:digit:]:[:digit:][:digit:]:[:digit:][:digit:].

It only found-next the three time-stamps. Interactively it works fine.

So, I'm guessing that this 6.2 commit is some major re-write of redlining, where the "deleted text" stays around as regular nodes and is just displayed or not. I wouldn't consider this a regression. I imagine there is a way the macro can be re-written to accommodate the change.
Comment 4 Mae Inman 2024-01-16 02:09:00 UTC Comment hidden (spam)
Comment 5 Thorsten Behrens (allotropia) 2024-05-13 13:54:28 UTC
Un-CCing developer, its unclear if we can find the time to look into it at this stage.