Bug 132922 - LibreOffice spelling dialog doesn't work correct for LT-4.7+
Summary: LibreOffice spelling dialog doesn't work correct for LT-4.7+
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Linguistic (show other bugs)
(earliest affected)
6.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Proofreading
  Show dependency treegraph
Reported: 2020-05-10 14:34 UTC by Yakov
Modified: 2023-12-02 06:07 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:

Test example. (4.24 KB, application/zip)
2020-05-10 14:37 UTC, Yakov

Note You need to log in before you can comment on or make changes to this bug.
Description Yakov 2020-05-10 14:34:25 UTC
"Ignore Once" work incorrectly in LO/OO for LT-4.7+.
If the text contains newline characters, an unexpected text change occurs when the button "Ignore Once" is clicked.

p.s. https://github.com/languagetool-org/languagetool/issues/2802

Steps to Reproduce:
1. Install LanguageTool 4.7 or 4.8
2. Open test file or type in Writer "Or use this text too
see an few of the problems that LanguageTool can detecd." After "too" added newline character.
3. Press F7
4. On grammar mistake press button "Ignore Once"
5. Text has changed.

Actual Results:
Text has changed.

Expected Results:
The text should not be changed after clicking the "Ignore once" button.

Reproducible: Always

User Profile Reset: No

Additional Info:
AOO 4.1 also affected.
Comment 1 Yakov 2020-05-10 14:37:12 UTC
Created attachment 160601 [details]
Test example.

Test example.
Comment 2 Mike Kaganski 2020-05-10 22:04:59 UTC
Reproducible with Version: (x64)
Build ID: b50bc319eca5cd5b66fbfe2ebd0d3bd1eed099b5
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded

and LanguageTool 4.8 (2019-12-27 13:18, 72d565f)

A pre-requisite for testing is disabling LightProof Grammar Checker in Options->Language Settings->Writing Aids, and make sure LanguageTool is checked for English (USA) in Edit Modules dialog (Edit button of Available language modules in the mentioned options page).
Comment 3 Mike Kaganski 2020-05-25 07:08:36 UTC
The problem is that edit engine treats every \n as a new paragraph (node), while in Writer, that is just a line break. So the text split by line breaks comes as several paragraphs into the spell dialog's edit engine. The dialog processes its first paragraph's errors (using character properties, which are bound to that paragraph first and last indices); thus from the dialog's PoV, each processed error may not end in a next paragraph.

An error like "too\nsee" is reported by spelling checker, with SpellErrorDescription having sErrorText equal to "too\nsee", and a suggestion to change that to "to see". When user chooses to skip, SentenceEditWindow_Impl::RestoreCurrentError compares SpellErrorDescription::sErrorText with GetErrorText() - the latter returns only the part of the error that is on the first edit engine paragraph, i.e. "too"; as the strings differ, the dialog considers that as if user modified the text manually, and the "too" is "replaced back" with "too\nsee".

Caolán: do you have an idea how to fix this?
Comment 4 Mike Kaganski 2020-06-12 14:21:25 UTC
Michael: seeing the fix for tdf#131912, maybe you can see a fix for that - is it possible to change the spelling dialog's SentenceEditWindow_Impl::RestoreCurrentError implementation to not make replacements, but use some "undo" mechanism to return to a checkpoint?
Comment 5 Michael Stahl (allotropia) 2020-06-12 14:44:44 UTC
that all sounds like an editengine problem? i don't know much about that.
Comment 6 Caolán McNamara 2020-06-16 08:11:27 UTC
I wonder if there's anything to be gained by replacing 0xa with 0xb at some point along the chain. IIRC editengine uses a different char for a hard newline
Comment 7 QA Administrators 2022-06-17 03:32:58 UTC
Dear Yakov,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team