Bug 139922 - Tools > Autocorrect > Apply with "Capitalize first letter in every sentence" [M] does not work on first sentence of a document following an initial empty paragraph
Summary: Tools > Autocorrect > Apply with "Capitalize first letter in every sentence" ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.3.0 target:7.2.5
Keywords: bibisected, bisected, regression
Depends on:
Blocks: AutoCorrect-Complete
  Show dependency treegraph
 
Reported: 2021-01-26 10:51 UTC by sdc.blanco
Modified: 2021-12-06 13:28 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
autoCorrect.odt: open and just run Tools - AutoCorrect - Apply (9.18 KB, application/vnd.oasis.opendocument.text)
2021-11-11 10:36 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2021-01-26 10:51:06 UTC
0. Tools > AutoCorrect > AutoCorrect Options - Options tab
   uncheck all [T] fields.  uncheck all [M] fields, except for 
   "Capitalize first letter of every sentence"

1.  Use "Default Paragraph Style" for all tests.

Test 1.

1. Open New Document.
2. On first line of document, write:  this is a sentence.   
3. Tools > AutoCorrect > Apply

Actual and Expected result:  "this" is changed to "This"


Test 2. 

1. Open New Document
2. Press Enter
3. on second line of document, write:  this is a sentence.
4. Tools > AutoCorrect > Apply

Actual result:  No change.
Expected result:  "this" --> "This"


Test 3. 

1. Open New Document
2. Press Enter
3. on second line of document, write:  this is a sentence. this is another.
4. Tools > AutoCorrect > Apply

Actual result:  The first "this" does not change.  The second "this" -> "This"
Expected result:  Both "this" --> "This"

Additional information:  
 - have also conducted these tests with longer paragraph (dt F3), with same results.
 - afterwards tried again with all settings unchecked in Localized Options, with same results
 - Does not matter if there are spaces or tabs before the first sentence (or not).  
 - Critical feature seems to be "first sentence" in paragraph (and not top of page).

Tested with:
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 86c8c775bbefe333d684e12c99855a3c1de68051
CPU threads: 8; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: en-US (en_DK); UI: en-US
Calc: threaded
Comment 1 V Stuart Foote 2021-01-26 16:31:20 UTC
Confirmed. But, note that the Default PS of the text in now 2nd paragraph is changed to Text Body PS, so an autoformat was applied. 

Just not the AF capitalization of the first sentence following an initial empty paragraph. Subsequent empty paragraphs do not affect capitalization of following paragraphs.
Comment 2 sdc.blanco 2021-01-29 15:43:03 UTC
 // Capitalize first letter of every sentence
844  void SvxAutoCorrect::FnCapitalStartSentence

https://opengrok.libreoffice.org/xref/core/editeng/source/misc/svxacorr.cxx?r=94306083#844
Comment 3 V Stuart Foote 2021-01-29 17:04:02 UTC
Suspect work on bug 108795 making the autocorrect stateful in the SvxAutoCorrect::DoAutoCorrect

https://cgit.freedesktop.org/libreoffice/core/commit/?id=c5fcab1ec72be1cf2868215ee71d3cb2668498c1&h=libreoffice-5-4

This issue does not occur in a build of 5.3.7.2 on hand, but needs a proper bibisect.
Comment 4 raal 2021-02-17 17:13:47 UTC
This seems to have begun at the below commit.
Adding Cc: to Michael Stahl ; Could you possibly take a look at this one?
Thanks
bibisect-linux-64-6.2$  01607703b961a83952bb39822a023c4d75c3136c is the first bad commit
commit 01607703b961a83952bb39822a023c4d75c3136c
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Fri Dec 7 19:26:05 2018 +0100

    source 4cf5a46f16dec8ce16c6662ce5c17903e28b8fa3

commit 4cf5a46f16dec8ce16c6662ce5c17903e28b8fa3	[log]
author	Michael Stahl <Michael.Stahl@cib.de>	Wed Nov 28 15:51:02 2018 +0100
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>	Fri Dec 07 13:08:58 2018 +0100
tree e65deb9f6801c6b45ad5cbdebb1d6baaae51a969
parent 180e5f515c9cd21fb8057c797a480eca7d9ed260 [diff]

sw_redlinehide_4a: SwAutoCorrDoc iterates frames, not nodes
Comment 5 raal 2021-02-17 17:14:20 UTC
bisected Test 2.
Comment 6 Justin L 2021-11-11 10:34:02 UTC
confirmed the bibisect. Updated the earliest affect version to 6.2.

Proposed fix at https://gerrit.libreoffice.org/c/core/+/125037
Comment 7 Justin L 2021-11-11 10:36:03 UTC
Created attachment 176188 [details]
autoCorrect.odt: open and just run Tools - AutoCorrect - Apply
Comment 8 Commit Notification 2021-11-16 15:08:10 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/59dc5d00b04927d07df2dcc3c17acfdc760d8765

tdf#139922 sw autocorr: don't return GetPrevPara if isEmpty

It will be available in 7.3.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 9 Commit Notification 2021-11-16 18:15:55 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/133fe29d06445daadc556cff013d5194a883ea9b

tdf#139922 sw autocorr: don't return GetPrevPara if isEmpty

It will be available in 7.2.4.

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 10 Commit Notification 2021-11-16 18:41:17 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/837bb7370b702399562a3b0b4e444237c66879a8

tdf#139922: sw_uiwriter3: Add unittest

It will be available in 7.3.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 11 Christian Lohmaier 2021-12-06 13:28:48 UTC
7.2.4 was a hotfix release, updating target in status-whiteboard