Description: When searching and replacing characters around a given string containing some italics, the $1 replacement option does not work as espected, that is, it changes which characters are in italics. Expression used Search: (\x20*)([\-|—|–]|\-{1,})([\x20]*)(.*?)([\x20]*)([\-|—|–]|\-{1,})(\x20*) Replace: – $4 –$7 (text example in the attached file) Steps to Reproduce: 1.Open attached file 2.Apply regular expression to the three portions of the text concerned under the title Before replacement, there are two words in italics: garçons and morceau. 3.After replacement, some italics have been shifted as shown in the same file under the headings: After replacement and Highlighting of the italics changed Actual Results: Italics of original shifted Expected Results: They should remain where they are Reproducible: Always User Profile Reset: Yes Additional Info: Version: 24.2.4.2 (AARCH64) / LibreOffice Community Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2 CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx Locale: en-US (en.UTF-8); UI: en-US Calc: threaded
Created attachment 195146 [details] Test file with results shown I have the impression that I have already submitted this bug, but I could not find any trace of it in my older bugs or my email.
Hi, am I meant to submit something to confirm it? I am changing the release: it still happens.
I can confirm that direct formatting of what is between the hyphens shifts to the left by one character. If it is repeated on the same text, it shifts by 2 characters at each run. Easier to see with text formatted with e.g. highlight. Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 8705cfecd5a10f817d3a2a02041d85e77282aa30 CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: CL threaded Version: 24.2.5.2 (X86_64) / LibreOffice Community Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59 In 7.6, formatting wouldn't be kept when the text was replaced. Formatting started being kept with: commit 0c3b89da7cde9866bf3174a6276736c76efb8356 author Matt K Thu Aug 03 00:06:24 2023 -0500 committer Mike Kaganski Fri Nov 10 19:05:13 2023 +0100 tdf#62603 Fix find/replace to not extend font attributes Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155274 ... which is [2098ffc1b2e5c669ae93d0fca25550c0446dcb2d] in the linux-64-24.2 bibisect repo. Matt, can you please have a look?
Hi I am attaching some new test cases in case they shed light on what is happening.
Created attachment 195456 [details] Another teste case
I forgot to mention what I am testing with: Version: 24.2.5.2 (X86_64) / LibreOffice Community Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59 CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx Locale: en-US (en.UTF-8); UI: en-US Calc: threaded
Thanks for following up, Daniele, but the "Version" field is for "earliest affected". I bibisected the issue to where it started in comment 3, which is 24.2 alpha0. It's potentially an implementation error, but Matt would know more. Let's see if a dev can now look into it.