Bug 36867 - [EDITING] Not currently possible to undo wrong autocapitalization in Calc
Summary: [EDITING] Not currently possible to undo wrong autocapitalization in Calc
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: x86 (IA32) All
: medium major
Assignee: Nickson Thanda
URL:
Whiteboard: target:6.2.0 target:6.1.0.1
Keywords:
: 93527 (view as bug list)
Depends on:
Blocks: Undo-Redo
  Show dependency treegraph
 
Reported: 2011-05-05 01:14 UTC by Kevin André
Modified: 2018-07-19 13:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
spreadsheet always capitalizes the letter "i" (8.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-10-09 19:57 UTC, broca_99
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin André 2011-05-05 01:14:07 UTC
Sometimes Calc can convert a lower case letter in a cell to an upper case letter, because it thinks you started a new sentence, but when in fact you haven't. In my case it always happens to the first letter of a word that follows an abbreviation.

Now, this unneeded auto-correction wouldn't be that bad if you could just undo it. But in Calc you unfortunately can't. The undo list only contains the line "Input" which contains both the actions of user input and the changes that were done automatically. In Writer you actually can undo an auto-correction. So this is inconsistent behavior. Disabling auto-correction in Calc completely isn't a real option either, because: what's the point of having a feature when you have to disable it all the time? :)

So the solution would be to create separate undo actions for the automatic changes, like it is done in Writer.

And, for bonus points, maybe make the editing process a bit smarter:

Suppose a cell is empty, and the user types "foo b.a.r. baz" and press ENTER. Then Calc foolishly changes "baz" into "Baz". Now the user doesn't like this, starts editing the cell again, changes the "B" back to a "b" and presses ENTER again. What happens? The "b" turns into a "B" again :S
Now, the program could be in this case a bit smarter, and notice that in the second edit the autocorrection is not what the user wants, simply because it would undo the entire edit.

In pseudo code, what should happen after an edit is closed by pressing ENTER (or similar) is something like this:

old_value = cell value before the user started editing;
new_value = cell value just entered;
autocorrected_value = autocorrect(new_value);
if (autocorrected_value == old_value) {
  // user manually reverted previous auto-correction
  change cell contents to new_value;
  create undo entry for the input;
}
else {
  change cell value to autocorrected_value;
  create undo entry for user input;
  create undo entry for each auto-correction;
}
Comment 1 Muthu 2011-05-05 01:44:45 UTC
I too faced a similar. This is also a problem while inputting email addresses.
E.g list of email addresses - I had to use paste-special or have a 'space' character postfix to workaround it.

One for kohei?
Comment 2 broca_99 2011-10-09 19:57:09 UTC
Created attachment 52161 [details]
spreadsheet always capitalizes the letter "i"
Comment 3 broca_99 2011-10-09 19:59:36 UTC
The letter "i" is always capitalized. Changing the tools-autocorrect option does not change this behavior. The rest of the alphabet is is not autocapitalized.
Comment 4 Owen Genat (retired) 2014-08-13 03:16:04 UTC
(In reply to comment #0)
> Suppose a cell is empty, and the user types "foo b.a.r. baz" and press
> ENTER. Then Calc foolishly changes "baz" into "Baz". 

Unable to reproduce under GNU/Linux x86_64 using these versions with a fresh user profile (en-AU locale):

- v4.1.6.2 Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
- v4.2.6.2 Build ID: 185f2ce4dcc34af9bd97dec29e6d42c39557298f
- v4.3.0.4 Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0

Entering a SPACE+ENTER or just ENTER after "baz" does not capitalise the "b". 

Under GNU/Linux x86_64 using v3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b it IS reproducible so it would appear the reported issue has been resolved at some point.

(In reply to comment #3)
> The letter "i" is always capitalized. Changing the tools-autocorrect option
> does not change this behavior. The rest of the alphabet is is not
> autocapitalized.

This is NOT the same issue. The reported problem was in relation to sentence case i.e., any letter being capitalised after a full stop. The letter "i" is a separate and special case as in typical English sentences it is always capitalised regardless of context. Please open a separate report for this issue and indicate the language / locale being used.

I think this bug can be RESOLVED as WORKSFORME (unless a related fix can be identified). Can others please test and confirm? Thanks.
Comment 5 Owen Genat (retired) 2014-08-13 04:03:28 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > The letter "i" is always capitalized. Changing the tools-autocorrect option
> > does not change this behavior. The rest of the alphabet is is not
> > autocapitalized.
> 
> This is NOT the same issue. [...] indicate the language / locale being used.

To be clearer, Tools > AutoCorrect Options > Options tab > uncheck "Use replacement table" option. This prevents the auto-capitalisation of "i" to "I" under GNU/Linux using v3.5.7.2 and v4.3.0.4 (both en-AU locale), but this may vary according to locale.
Comment 6 Kevin André 2014-09-18 16:22:30 UTC
I have tested with LO version 4.2.5, and the capitalization indeed does not happen anymore after an abbreviation.

But that's not what this bug was about. The core issue here is that any automatic change done by Calc to the text you write in a cell (like capitalization) is NOT added separately to the undo stack. So you cannot undo the automatic change without also undoing the text you typed yourself.

For example, in some cases Calc will capitalize the first letter of a cell. If that's what you want at that time then okay, fine. But if the capital letter is not desired, you cannot simply press 'undo' to get the small letter back. Because 'undo' will undo much more than that; it will even erase the cell completely if you typed the text all at once.

The correct behavior would be to add the user input and the automatic changes as separate steps in the undo stack. Right now they are still combined into one single step.
Comment 7 Alex Thurgood 2015-12-21 07:30:24 UTC
*** Bug 96582 has been marked as a duplicate of this bug. ***
Comment 8 ge.huber 2016-01-02 21:52:51 UTC
I second the comment by Kevin André.  
Same problem here.
Version: 5.0.4.2
Build-ID: 1:5.0.4~rc2-0ubuntu1~trusty1
Gebietsschema: de-DE (de_DE.UTF-8)
Comment 9 MarjaE 2016-01-06 02:32:21 UTC
Also occurs in Mac OS X. Major bug, because there's no visible option to disable autogarble.
Comment 10 MarjaE 2016-01-06 02:34:13 UTC
Also occurs in Mac OS X. Major bug, because there's no visible option to disable autogarble. P.S. The site won't let me correct the importance.
Comment 11 MarjaE 2016-01-06 02:49:20 UTC
*** Bug 93527 has been marked as a duplicate of this bug. ***
Comment 12 MarjaE 2016-01-06 02:50:20 UTC
Bug 93527 is the same bug in Windows.
Comment 13 ge.huber 2017-01-31 10:11:51 UTC
Nuisance still with us in 

Version: 5.2.2.2
Build-ID: 1:5.2.2-0ubuntu2
CPU-Threads: 2; BS-Version: Linux 4.8; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE.UTF-8)

Writing BVordG into an empty cell of a new document autocorrects to BvordG. CTRL+Z wipes the whole cell clean instead of only reversing the autocorrect.
Comment 14 ge.huber 2017-05-19 07:15:58 UTC
The problem still exists in Version: 5.3.1.2, Build-ID: 1:5.3.1-0ubuntu2
I resent, that this is classified as an "enhancement". If Ctrl-Z after an autocorrect not only undoes the autocorrect but also everything the user typed before, this is clearly a bug to me. There is no discernible logic in this behaviour, the more so, because in Writer it works exactly as expected and therefore differently than in obviously broken Calc. Please fix the mess. Pretty please.
Comment 15 Commit Notification 2018-06-28 11:30:11 UTC
Nickson Thanda committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0e0ceebc0d6facf803ad089ef38d559355407c54

tdf#36867 - Undo autocapitalization when inserting a cell in Calc

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2018-06-29 10:13:51 UTC
Nickson Thanda committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=828cea44d910d8f0e27519b4283c9038bcb022ac&h=libreoffice-6-1

tdf#36867 - Undo autocapitalization when inserting a cell in Calc

It will be available in 6.1.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.