Bug 157999 - EDITING Unwanted case change when adjusting duplicate entry in column
Summary: EDITING Unwanted case change when adjusting duplicate entry in column
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: AutoCorrect-Complete
  Show dependency treegraph
 
Reported: 2023-10-31 08:33 UTC by Aron Budea
Modified: 2023-11-03 15:55 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample ODT (8.57 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-10-31 08:33 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2023-10-31 08:33:19 UTC
Created attachment 190529 [details]
Sample ODT

- Open the attached spreadsheet,
- In cell A1, which has the text "This Test" (just like A10), replace the 2nd "T" with "t" and press Enter.

=> A1 should be "This test" but becomes "This Test".

The behavior depends on another cell in the same column having the same content.

This could be observed in LO 24.2.0.0.alpha0+ (5e726afaf08c8cc59124d9551bb083220a38821e) / Windows.

Interestingly, not before the following commit... or rather, not in the same way:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=7a2616501bba1225df3f6bc0225c3d5a7a692002

author		Mike Kaganski <mike.kaganski@collabora.com>	2021-11-29 15:32:39 +0200
committer	Mike Kaganski <mike.kaganski@collabora.com>	2021-11-29 21:31:21 +0100

"tdf#144308: don't cache DoAutoComplete/AutoInput in ScInputHandler"

However, the bug still occurs when repeating the 2nd step, so this change is a red herring. It seems Calc behaved with with this adjusted reproducer before 4.2.0.4, it might be worth checking when that started.

The bug occurs, because the following is triggered in ScInputHandler::EnterHandler(...):
// Perform case-matching only when the typed text is partial.
if (pColumnData && aAutoSearch.getLength() < aString.getLength())
    aString = getExactMatch(*pColumnData, aString);
https://opengrok.libreoffice.org/xref/core/sc/source/ui/app/inputhdl.cxx?r=fee44aa4#3316

Limiting this to when 'aAutoSearch' is not empty would help in this case (it is empty with these steps), however there's a different way to trigger the bug:
- Type "T" in an empty cell in column A, which gives you the suggestion "T" + "his Test",
- Click after 2nd "T", press Backspace, then "t" and press Enter.

Here 'aAutoSearch' has "T" in it, so the unwanted replacement would happen anyway.
I think after accepting or discarding the suggestion, 'aAutoSearch' should be cleared, while it only seems to be updated as you type. see:
https://opengrok.libreoffice.org/xref/core/sc/source/ui/app/inputhdl.cxx?r=fee44aa4#3970

An old commit touching autoinput, resulting in the code snippet above:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=d8bb8c4fb850b9de762567ed7d337972467470d6
author		Kohei Yoshida <kyoshida@novell.com>	2010-09-16 10:22:36 +0200
committer	Fridrich Štrba <fridrich.strba@bluewin.ch>	2010-09-16 10:22:36 +0200

"calc-autoinput-case-insensitive-matching.diff: no case matching on autoinput"
for https://bz.apache.org/ooo/show_bug.cgi?id=101046
Comment 1 TBeholder 2023-10-31 09:38:27 UTC
And it does not always work, either.
Not as much bug, as a feature that’s invasive and does not turn off easily.
Autocorrect and autoinput definitely became work-adding features as much as work-saving, need more explicit options.

As a practical workaround, Ctrl-Z reverses those autocorrect actions.In the undo/redo list they are just generic “Input”, so not immediately obvious.
Comment 2 Buovjaga 2023-11-03 15:55:26 UTC
Reproduced with document

Arch Linux 64-bit, X11
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4af07053517ba3526d4050ffc29993a65b54352b
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 3 November 2023