Created attachment 188328 [details] A wrong word with three comments In the attached document, there is a spelling error "lightninng"; that word has three comments in it. 1. Make sure that a spell checker is installed for en-US; 2. Start to check spelling (F7); 3. When the word is selected, and a correction is suggested, press [Correct] button to replace the error with correct spelling. The "foo" comment will be moved to the end of the replaced word (which is OK); but the other two comments disappear. Code pointer: https://opengrok.libreoffice.org/xref/core/sw/source/uibase/shells/textsh1.cxx?r=6591a83a#2125 See how the same thing (keeping comments) is implemented in https://opengrok.libreoffice.org/xref/core/sw/source/core/table/swtable.cxx?r=3c1fee94#2432
Confirmed in: Version: 7.5.4.2 (X86_64) / LibreOffice Community Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded And in 6.4: Version: 6.4.7.2 Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; Locale: en-AU (en_AU.UTF-8); UI-Language: en-US Calc: threaded 6.3 would delete all comments. Related changes are in bug 65535.
I can also reproduce it (Version 7.3.7.2. and todays repo pull - Version 24.2.0.0.alpha0+). I'll work on it.
EMartinGube committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6da9d629f7f17ec569e7fb6d0f1931dd410b1d28 tdf#156250: sw: Keep comments when spell correction replaces a word It will be available in 24.2.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.
Looks like this can be closed as fixed.