Bug 145603 - Drag-n-drop in formula bar creates mismatch between cell and formula bar
Summary: Drag-n-drop in formula bar creates mismatch between cell and formula bar
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.5
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2021-11-09 15:02 UTC by Ming Hua
Modified: 2022-09-03 05:29 UTC (History)
3 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 Ming Hua 2021-11-09 15:02:19 UTC
Description:
When using mouse to highlight part of the string in formula bar, then drag-n-drop'ing it to a different place, the string in the formula bar changes as expected, but the string in the cell doesn't change.  This mismatch persists in future editing attempts made in the formula bar, creating all sorts of problems.

Steps to Reproduce:
1. Create a new empty spreadsheet;
2. Enter a relatively long formula in cell A1, for example "=SUM(B1:B3)+SUM(C1:C3)";
3. Click in the formula bar to enter editing mode in formula bar.  In the default configuration now the B1:B3 and C1:C3 cells should be highlighted with different color borders (not sure if this part is relevant);
4. Highlight part of the formula, for example the latter half "+SUM(C1:C3)";
5. Use mouse to drag-n-drop it to the front of the formula, after the "=" character;
6. Observe that in the formula bar, the string is "=+SUM(C1:C3)SUM(B1:B3)" as expected, but in cell A1 the string is unchanged, still "=SUM(B1:B3)+SUM(C1:C3)";
7. (Optional) Further editing attempts in formula bar with keyboard will operate at the same position of two strings, but of course operate on different characters, and are all messed up.  For example, use arrow key or Home/End key to put cursor between "=" and "+" (mouse clicking seems to work as well), then Delete key, will delete "+" in the formula bar, but will delete "S" (leaving "=UM(B1:B3)+SUM(C1:C3)") in A1 cell.  The final Enter key which exits editing mode and commits the formula, will synchronize both places with the string in cell A1.  So for users accustomed of focusing on the formula bar during editing, this unfortunately gives wrong and unexpected result.

Version Information:
I've heard similar symptoms among the chatters in the Chinese user community for a while, but only recently be able to experience it myself and investigate.

I can reproduce with both 7.2.3 RC1 and 7.3/master on Windows 10:
Version: 7.2.3.1 (x64) / LibreOffice Community
Build ID: 1d5dee817bde88d78dbcc0d00f88492568e131d5
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded
and
Version: 7.3.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: c7500945fc5d5bd2130a2d38be0bd4b15445cd90
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded

The other occurrences I've heard about seem to be on Windows as well, so tentatively setting the OS field.

In 7.1.7 I can not test because drag-n-drop is not possible in formula bar (mouse cursor becomes "forbidden"):
Version: 7.1.7.2 (x64) / LibreOffice Community
Build ID: c6a4e3954236145e2acb0b65f68614365aeee33f
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded

In 7.0.6 I can not reproduce, the formula bar and cell A1 keep synced after drag-n-drop:
Version: 7.0.6.2 (x64)
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: threaded

Therefore this is also some sort of regression/ImplementationError.
Comment 1 Ming Hua 2021-11-09 15:10:19 UTC
I suspect bug 145248 is about the same issue, though I didn't investigate that one closely.
Comment 2 zcrhonek 2021-12-31 10:24:03 UTC
This seems to have begun at the below commit.
Adding Cc: to Noel Grandin; Could you possibly take a look at this one?
Thanks
 5b0911f11f89313dbc3b081737b2a028af51a1a9 is the first bad commit
commit 5b0911f11f89313dbc3b081737b2a028af51a1a9
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Thu Jul 8 21:45:30 2021 +0200

    source 60d35f767781de4b8f1e7b264b12015f655c647d

https://gerrit.libreoffice.org/c/core/+/118508
 tdf#132740 don't broadcast if modified status has not changed
Comment 3 Commit Notification 2022-06-02 12:23:11 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0030fa0d5174b45ae7f99e3ae923bbec83e50cd1

tdf#145603 Drag-n-drop in formula bar creates mismatch

It will be available in 7.4.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 4 Commit Notification 2022-06-05 15:12:46 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/6aaac2a8f0330e7efb4bf6d6385f9fadb086702e

tdf#145603 Drag-n-drop in formula bar creates mismatch

It will be available in 7.3.5.

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 5 MichelleHernandez 2022-08-27 10:58:25 UTC Comment hidden (spam)
Comment 6 Ming Hua 2022-09-03 05:29:09 UTC
Fix confirmed with 7.4.0:
Version: 7.4.0.3 (x64) / LibreOffice Community
Build ID: f85e47c08ddd19c015c0114a68350214f7066f5a
CPU threads: 12; OS: Windows 10.0 Build 22000; UI render: Skia/Raster; VCL: win
Locale: en-US (zh_CN); UI: zh-CN
Calc: CL

Thanks Noel!