Bug 152107

Summary: Clicking on a cell shows garbage as the formula
Product: LibreOffice Reporter: Martin Feeney <mjfeeney>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED NOTABUG    
Severity: normal CC: mjfeeney, stephane.guillou
Priority: medium    
Version: 7.4.2.3 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: Screenshots showing the issue in action
Example Spreadsheet to recreate the problem

Description Martin Feeney 2022-11-18 12:31:23 UTC
Description:
I have a spreadsheet containing my annual household budget.  The sheet has a multiple of cells that contain @SUM() statements.  If I double click on the cell (e.g. N35), I see the cell formula (as expected).  If I double click on another cell (e.g. N34), cell N35 is replaced with garbage that is a combination of N45 and N45.  If I repeat this sequence but hit the ESC key to clear the contents of N34, cell N34 will display as expected (i.e. in N34 and with the correct formula). 

Steps to Reproduce:
1.Create a budget style spreadsheet.  Mine has a description column, 12 monthly expense columns and a final Total column.  Populate some data in the 12 monthly columns for several budget items.  In the Total column, use the @SUM() formula to calculate the sum of the 12 monthly values.  Finally, create a new row which is uses the @SUM() formula to summarize each column.
2. Double Click on the final cell in the Total column.
3. Double Click on the cell above the final cell in the Total column

Actual Results:
At Step (2), the selected Cell contains the correct formula.
At Step (3), the selected Cell contains garbage.

Expected Results:
At step (3), I expect the cell contents to be displayed correctly.


Reproducible: Always


User Profile Reset: No

Additional Info:
I can create screen shots of this sequence if that facilitates recreating the issue.

Version: 7.4.2.3 (x64) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Martin Feeney 2022-11-18 12:47:23 UTC
Created attachment 183665 [details]
Screenshots showing the issue in action
Comment 2 Stéphane Guillou (stragu) 2022-11-18 15:45:12 UTC
If I understand well, what you see is expected. When editing a formula, clicking on another cell will insert the coordinate in the formula you are currently editing.
Before clicking on another cell, you will have to get out of edit mode by e.g. pressing Enter.
If you only want to see the formula and not edit it, click once on the cell and look at the formula bar (aka "input line").
Comment 3 Martin Feeney 2022-11-18 16:07:04 UTC
Thanks for the update.

Did you run the recreation on your system?  Does each cell show the correct data?  I am not trying to edit the cell - I just wanted to see it's formula (to verify that it was correct).

I did this same experiment on MS Excel and SoftMaker Office2001 PlanMaker.  Both behave as I expect.  I could double click on a cell and it would appear where I expected and with the data I expected.

I believe your behavior is incorrect.  I installed LibreOffice to try it out.  If this is appropriate behavior, I will be deinstalling the product.
Comment 4 Martin Feeney 2022-11-18 20:41:39 UTC
Created attachment 183669 [details]
Example Spreadsheet to recreate the problem

Use this spreadsheet to recreate the problem.  

Steps:
   1) Double left-click on cell N33.  You should see the cell replaced with the formula =SUM(B33:M33).
   2) Move the cursor cell N32 and double left-click.  Cell N33 is overwritten with the value =SUM(N32B33:M33).  I expected N32 to display =SUM(B32:M32).  MS Excel and Softwork Office 2001 display this value.

There are two issues: Cell N33 is not restored to it's value (15705) and the formula for cell N32 is partially written into Cell N33.

If you repeat the process but hit the ESC key between steps 1 and 2, the program behaves as expected.
Comment 6 Stéphane Guillou (stragu) 2022-11-21 15:11:39 UTC
Thank you for sharing the example document, Martin!

Apologies, but once again: it behaves as planned. Double-clicking on a cell will start edit mode, and the cursor will be placed where the pointer was. In edit mode _for a formula_, clicking another cell will insert a reference in the formula. This is why double-clicking (or single click, the number of clicks does not change the behaviour) will insert the cell reference in the formula currently being edited. This is useful to insert cell or range references quickly with the mouse.

(In reply to LeroyG from comment #5)
> Related question in the ask site:
> 
> https://ask.libreoffice.org/t/disable-calc-automatically-selecting-a-cell-
> when-clicking-out-of-another-cell/83939

As Leroy is showing, some users would like to be able to turn this off. If you'd like that option as well, please feel free to open a new bug report for that (and mark it as an "enhancement"). (I couldn't see an existing one.)

Cheers!