Bug 229328 - autocorrection doesn't take capital letters into account
Summary: autocorrection doesn't take capital letters into account
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: flake-texttool-plugins (show other bugs)
Version: 2.1
Platform: unspecified Unspecified
: NOR normal
Target Milestone: ---
Assignee: Thomas Zander
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2010-03-03 23:18 UTC by Eckhart Wörner
Modified: 2010-03-29 22:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix advance autocorrection (948 bytes, patch)
2010-03-22 03:01 UTC, Glen Kaukola
Details
advancedAutocorrect() punctuation handling (2.14 KB, patch)
2010-03-29 14:02 UTC, Glen Kaukola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eckhart Wörner 2010-03-03 23:18:42 UTC
Version:            (using KDE 4.4.1)

When starting a sentence with "Youre", KWord applies autocorrection and corrects it into "you're" which means that the capital "Y" gets lost. Verified with KWord 2.1.0.
Comment 1 Thomas Zander 2010-03-05 15:02:57 UTC
Sounds like something that could be done as a junior-job. The code lives in koffice/plugins/textediting/autocorrection/
Comment 2 Glen Kaukola 2010-03-21 23:20:55 UTC
Question:  Is there a better way to go about letting people know I'm tackling this bug than just posting to the bug tracker?

Anyway, advanced autocorrection seems to be the culprit here.  Basically anything that's corrected by it gets converted to lower case.  Even when the replacement word starts with a capital.  For example "Enland" would get replaced by "england" and not "England", "Brittish" by "british", and so on.

Something like "Youre" however will get turned into "You're" if the "Convert first letter of a sentence automatically to uppercase" option is on.  But I think advanced autocorrection shouldn't need to rely on that when words are already capitalized, so that's how I'm going to proceed.  I should have a patch shortly.
Comment 3 Glen Kaukola 2010-03-22 03:01:13 UTC
Created attachment 41824 [details]
Fix advance autocorrection

Patch to make sure that things fixed by advanced autocorrection remained capitalized if they're originally capitalized.
Comment 4 Glen Kaukola 2010-03-22 03:10:12 UTC
Things are perhaps still get screwed up when words like "ENLAND" are typed.  It's unclear to me whether or not that should result in "England", or result in "ENGLAND".

And perhaps words that end with a punctuation mark aren't behaving right.  For sure "1/2." doesn't behave as advertised.  I'll investigate further.
Comment 5 Glen Kaukola 2010-03-27 19:23:38 UTC
advancedAutocorrect() doesn't take punctuation into account.
Comment 6 Thomas Zander 2010-03-28 13:25:06 UTC
SVN commit 1108260 by zander:

Fixes: autocorrection doesn't take capital letters into account

BUG:229328

This patch detects when the user typed a word that had at least
one uppercase character and follows that in the replacement.
Future enhancement might be to look at more characters, but for now
I think this is already a huge advancement.

Patch from Glen Kaukola, thank you! :-)

 M  +7 -0      Autocorrect.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1108260
Comment 7 Glen Kaukola 2010-03-29 14:02:16 UTC
Created attachment 42346 [details]
advancedAutocorrect() punctuation handling

Patch for the handling of punctuation in advancedAutocorrect().
Comment 8 Thomas Zander 2010-03-29 22:50:32 UTC
SVN commit 1108815 by zander:

Fix autocorrect punctuation handling

BUG:229328

Patch from Glen Kaukola, thanks a lot! :)

 M  +23 -6     Autocorrect.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1108815