Bug 156250 - Spellcheck's [Correct] button drops all but one comments
Summary: Spellcheck's [Correct] button drops all but one comments
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.7.2 release
Hardware: All All
: medium normal
Assignee: Martin Gube
URL:
Whiteboard: target:24.2.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Spell-Checking Writer-Comments
  Show dependency treegraph
 
Reported: 2023-07-12 11:14 UTC by Mike Kaganski
Modified: 2023-10-15 05:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
A wrong word with three comments (28.70 KB, application/vnd.oasis.opendocument.text)
2023-07-12 11:14 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-07-12 11:14:38 UTC
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
Comment 1 Stéphane Guillou (stragu) 2023-07-12 16:11:14 UTC
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.
Comment 2 Martin Gube 2023-07-14 21:35:44 UTC
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.
Comment 3 Commit Notification 2023-10-15 05:42:23 UTC
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.