Bug 155018 - Manual auto correct failure in Writer
Summary: Manual auto correct failure in Writer
Status: RESOLVED DUPLICATE of bug 128192
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-25 18:40 UTC by Baole Fang
Modified: 2023-04-25 21:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Baole Fang 2023-04-25 18:40:12 UTC
Description:
In Writer, manual auto correct (Tools/AutoCorrect/Apply) fails after the first two times.

Steps to Reproduce:
1.Open Writer
2.Go to "Tools/AutoCorrect", and uncheck "While typing"
3.In the first line, type "www.google.com".
4.Select the first line, and click "Tools/AutoCorrect/Apply". A hyperlink is created.
5.Go to the second line, and type "www.google.com" again.
6.Select the second line, and click "Tools/AutoCorrect/Apply". A hyperlink is created.
7.Go to the third line, and type "www.google.com" again.
8.Select the third line, and click "Tools/AutoCorrect/Apply". A hyperlink should be created, but it isn't.

Actual Results:
The hyperlink is only created in the first two times, but not in the following times.
Sometimes, no hyperlink is created in step 6 (second time).

Expected Results:
A hyperlink should always be created.


Reproducible: Always


User Profile Reset: No

Additional Info:
After step 6, no matter where you type a url, it is almost certain that no hyperlinks will be created by manually clicking "Tools/AutoCorrect/Apply".
Comment 1 Baole Fang 2023-04-25 18:47:10 UTC
When clicking Tools/AutoCorrect/Apply, SwAutoFormat::SwAutoFormat in sw/source/core/edit/autofmt.cxx is being called.

During the first two times when auto correct works, eStat is set to TST_TXT_BODY and BuildText() is called, where text related auto correct is run, including URL Recognition, Capitalize first letter, etc.

However, when manual auto correct fails, eStat is never set to TST_TXT_BODY, so BuildText() is never called.

The fix should start from fixing the eStat jumping logics.
Comment 2 Stéphane Guillou (stragu) 2023-04-25 21:02:47 UTC
Thanks Baole.

I think this is already covered by bug 90507 and bug 128192:
applying the autocorrect rule changes the style from Default Paragraph Style to Text Body, and because autocorrect doesn't ever (?)[1] apply to other paragraph styles, it does not work on subsequent strings.
Wondering if you can decide on which bug this is a duplicate of, and maybe continue the conversation there?
It would be wonderful if you could work on some patches on this issues, as many reports are linked to this limitation: https://bugs.documentfoundation.org/showdependencytree.cgi?id=103341&hide_resolved=1

[1] question mark because I am still unsure of the intricacies of how autocorrect and styles interact.
Comment 3 Baole Fang 2023-04-25 21:54:32 UTC
Thank you for your comment.

It is indeed true that this bug happens because the style becomes "Text Body" instead of "Default Paragraph Style", so this bug should be a duplicate of bug 128192.

It is also true that the logic behind Tools/AutoCorrect/Apply is complicated, and I'm happy to work on it in bug 128192. But it will take some time :(
Comment 4 Baole Fang 2023-04-25 21:55:32 UTC

*** This bug has been marked as a duplicate of bug 128192 ***