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: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.4.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: AutoCorrect-Complete
  Show dependency treegraph
 
Reported: 2018-05-16 19:27 UTC by SNORT
Modified: 2018-07-27 13:32 UTC (History)
5 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.