In a Writer text, type: Something Foo - 111--222 (after the last "2", type a space) The text will get replaced into Something Foo – 111–222 so the first dash turns into an en-dash, and the two dashes between 111 and 222 turn into another en-dash. So far so good, this is the expected and wanted behavior. Now delete everything, and type Something Foo -- 111--222 (after the last "2", type a space) The text will get replaced into Something Foo – 111-–22 so the first two dashes turn into an en-dash (as expected), but the two dashes between numbers get replaced incorrectly: the first dash is kept, and the autocorrection replaced the text "-2" with an en dash. This is wrong character indices used in SvxAutoCorrect::FnChgToEnEmDash, that don't take into account that the document text may change length as the result of the first replacement.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/075ecc1c31199d0fd0f930cf1b803b04a3b17ce8 tdf#155407: fix the second replacement in FnChgToEnEmDash It will be available in 7.6.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.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/9eae9409a739c21ea27a480f55b434df8e613acd tdf#155407: fix the second replacement in FnChgToEnEmDash It will be available in 7.5.5. 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.
*** Bug 94911 has been marked as a duplicate of this bug. ***
Started in 7.4 but inconsistent results (why...?) made it not worth pinpointing. Verified in: Version: 7.6.0.0.beta1 (X86_64) / LibreOffice Community Build ID: be55b15d98c5f059483845a183fcb5ea8023d27c CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Thanks Mike, it also fixed ~8yo bug 94911.