Bug 117651 - AutoCorrect does not change preexisting text inside /slashes/ to italics, nor change -strikethrough-
Summary: AutoCorrect does not change preexisting text inside /slashes/ to italics, nor...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.3 release
Hardware: All All
: medium normal
Assignee: Matt K
URL:
Whiteboard: target:24.2.0 target:24.8.0 target:24...
Keywords: difficultyBeginner, easyHack, implementationError, skillCpp
: 139987 (view as bug list)
Depends on:
Blocks: AutoCorrect-Complete
  Show dependency treegraph
 
Reported: 2018-05-16 19:27 UTC by SNORT
Modified: 2023-12-11 19:40 UTC (History)
11 users (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 SNORT 2018-05-16 19:27:14 UTC
Description:
I am trying to convert an old story to HTML. I'd previously used asterisks to indicate italics. In AutoCorrect options, it plainly says "Automatic *bold*, /italic/, -strikeout- and _underline_". So I find+replaced all the asterisks with slashes. I clicked apply, and none of the words became italicized. It turned the remaining asterisks to bold, and the underscores to underlined text, but it absolutely will not make italics.

When typing new text inside this document, it will AutoCorrect slashes to italics. But it ignores all the old text. All it does is change the font.

I just upgraded from 5.4.1.2 to 6.0.4.2, and the problem still exists.

Steps to Reproduce:
1. Put slashes around a word.
2. Check that / -> italics is checked in AutoCorrect options
3. Click Apply


Actual Results:  
The text does not change. (However, the font changes from Times New Roman to Alias)

Expected Results:
The text becomes italicized.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: TextDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no

Version: 6.0.4.2 (x64)
Build ID: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: en-US (en_US); Calc: group


User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Comment 1 Regina Henschel 2018-05-16 22:51:39 UTC
As described. Same with -strikeout-. The options strikeout and italic are implemented in 5.4 with commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=6bfe94a631b5c5029a1f96a52b000d25e33bad4a.
Comment 2 V Stuart Foote 2018-05-17 01:46:13 UTC
Not sure this is incorrect behavior.

The two "modes" of autocorrect are while modifying [M] and while typing initial text [T]

The correction for typing new text occurs when the closing *, _, -, or / is entered. Likewise with existing text, modifying makes the autocorrection for each enclosing *, _, -, or /

Performing a Find & Replace will make the substitution, but I don't believe it is expected to pass the text back through the edit shell to then perform an autocorrect. Should it? Not as implemented.

And, revisiting the strings just replaced, backspacing over the closing mark and replacing it triggers the [M] autocorrect for each of the formats--Bold, Underline, Strikethrough, and Italic.

Checked behavior in
Version: 5.3.7.2 (x64)
Build ID: 6b8ed514a9f8b44d37a1b96673cbbdd077e24059
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; Layout Engine: new; 
Locale: en-US (en_US); Calc: group

prior to adding the / italic and - strikethrough--Find & Replace did not trigger the * bold or _ underline autoreplace in that build.
Comment 3 V Stuart Foote 2018-05-17 01:53:06 UTC
Is there, or should there be, optional linkage for Find & Replace to trigger Auto-correct?
Comment 4 SNORT 2018-05-17 02:18:32 UTC
WHAT!? Of course this is incorrect behavior!

Tools/AutoCorrect/Apply. Right there. Clicking that works with bold and underline, but NOT italics.  If it DIDN'T replace asterisks with bolding and underscores with underlining, I would say that maybe it just couldn't do that at all. But it is  doing HALF ITS JOB. Why!?

And yes, I could go through the entire text and manually delete+replace every / to trigger AutoCorrect normally. That would take an entire days' worth of monotonous work. This is a NOVEL.


> Not sure this is incorrect behavior.

> Performing a Find & Replace will make the substitution, but I don't believe
> it is expected to pass the text back through the edit shell to then perform
> an autocorrect. Should it? Not as implemented.
Comment 5 V Stuart Foote 2018-05-17 05:35:52 UTC
(In reply to SNORT from comment #4)
> ...
> 
> Tools/AutoCorrect/Apply. Right there. Clicking that works with bold and
> underline, but NOT italics.  If it DIDN'T replace asterisks with bolding and
> underscores with underlining, I would say that maybe it just couldn't do
> that at all. But it is  doing HALF ITS JOB. Why!?
> 

Hmm, my bad. I'd mistakenly made a target text selection and then applied the autocorrect.

Seems when applying the autocorrect to existing text, a selection is not needed nor helpful--as the autocorrect simply runs through the whole document.

So confirming that the Tools -> Autocorrect -> Apply autocorrect does render the * Bold or _ Underline markup, but not the / Italic nor the - Strikethrough. 

So there is an implementation error--something more needed to be connected to get the same behavior.

> And yes, I could go through the entire text and manually delete+replace
> every / to trigger AutoCorrect normally. That would take an entire days'
> worth of monotonous work. This is a NOVEL.
> 
> 

No need, just do the * bold or _ underline Find & Replace with "Whole words only" checked, apply the Autocorrect for those to have distinct formatting to work against.

Then change the direct formatting with Find & Replace with Find using Other Options -> Attributes--probably with the Including Styles checkbox.

Pick an Attribute and use the Format button's dialog to configure first the Find field, and then the Replace field. It is a little bit fussy to get the right mix for desired result, but seems to work.

It is a shame that doing it directly for / italic or - strike through with an autocorrect is not 100% yet.
Comment 6 Mike Kaganski 2018-06-12 06:50:07 UTC
Commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=6bfe94a631b5c5029a1f96a52b000d25e33bad4a had omitted SwAutoFormat::AutoCorrect in sw/source/core/edit/autofmt.cxx, which still only handles '*' and '_' to call SvxAutoCorrect::FnChgWeightUnderl.
Comment 7 QA Administrators 2019-07-30 03:13:09 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2019-07-30 19:26:56 UTC
The error still exists in Version: 6.4.0.0.alpha0+ (x64)
Build ID: 9105b85c708f42024ce063b9a944466c0afdfe9a
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-06-28_22:42:37
Locale: de-DE (en_US); UI-Language: en-US
Calc: CL
Comment 9 V Stuart Foote 2021-01-30 16:58:43 UTC
*** Bug 139987 has been marked as a duplicate of this bug. ***
Comment 10 Stéphane Guillou (stragu) 2023-01-03 17:33:23 UTC
Also on Linux, also in 7.5:

Version: 7.5.0.1 (X86_64) / LibreOffice Community
Build ID: 77cd3d7ad4445740a0c6cf977992dafd8ebad8df
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 11 Stéphane Guillou (stragu) 2023-03-31 16:22:16 UTC
Hossein, seeing Mike's comment 6, maybe an easyHack?
Comment 12 Hossein 2023-05-04 13:50:48 UTC
(In reply to Stéphane Guillou (stragu) from comment #11)
> Hossein, seeing Mike's comment 6, maybe an easyHack?
Yes. I've marked it as an EasyHack. One should follow comment 6 to find the code pointers.
Comment 13 Matt K 2023-07-07 22:56:19 UTC
Fix is tracked in https://gerrit.libreoffice.org/c/core/+/154207.  Added Mike to review.
Comment 14 Commit Notification 2023-11-21 05:53:23 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2fa88bfbfa4c9befe1be8a1953c018437a621254

tdf#117651 Add AutoCorrect support for italic and strikethrough

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.
Comment 15 Buovjaga 2023-12-02 18:39:56 UTC
Can this be closed as fixed?
Comment 16 Matt K 2023-12-02 22:22:55 UTC
(In reply to Buovjaga from comment #15)
> Can this be closed as fixed?

Yes, closing it.
Comment 17 Stéphane Guillou (stragu) 2023-12-05 09:36:38 UTC
Just tested it but it only works for strikethrough, not for italics.
I used the original steps with a fresh profile:

(In reply to SNORT from comment #0)
> Steps to Reproduce:
> 1. Put slashes around a word.
> 2. Check that / -> italics is checked in AutoCorrect options
> 3. Click Apply
Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 43967453e15e1d054972a7586cfef8f8e0866270
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Can you please check? Does it work with those steps on your end?
Comment 18 V Stuart Foote 2023-12-05 13:58:15 UTC
Confirm not yet correct, with the AutoCorrect options for M and T both checked--the italic markup with "/" bracketing does not correct during modify. But it does apply while typing.


Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 01a02ee7f1dbe7501a89b41e62599fba6a8b33f3
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

with 2fa88bf applied, something not quite behaving.
Comment 19 Matt K 2023-12-10 03:10:20 UTC
New fix is tracked in https://gerrit.libreoffice.org/c/core/+/160529.  Added Mike to review.
Comment 20 Matt K 2023-12-10 20:06:31 UTC
Also, the fix for the debug assert is at: https://gerrit.libreoffice.org/c/core/+/160547
Comment 21 Commit Notification 2023-12-11 04:36:54 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dc8b69e3393d4f71900ea871db5598a5f7af567e

tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underline

It will be available in 24.8.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.
Comment 22 Commit Notification 2023-12-11 04:38:56 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/90d732a5311551ae79969ee24d98cf21ffbacac7

tdf#117651 Fix AutoCorrect crash for italic, strike, bold, and underline

It will be available in 24.8.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.
Comment 23 Matt K 2023-12-11 04:44:09 UTC
Now it should be fixed :) -- closing.
Comment 24 Commit Notification 2023-12-11 13:15:03 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/8d3092eaea3fba2b96318d09722ca15b75a5b467

tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underline

It will be available in 24.2.0.0.beta2.

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.
Comment 25 Commit Notification 2023-12-11 19:40:46 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/127ec9a20d837775bf46714dba9eccda62b12dde

tdf#117651 Fix AutoCorrect crash for italic, strike, bold, and underline

It will be available in 24.2.0.0.beta2.

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.