Bug 137899 - The text present in a cell that is being edited will appear in a new sheet
Summary: The text present in a cell that is being edited will appear in a new sheet
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium trivial
Assignee: Justin L
URL:
Whiteboard: target:7.4.0
Keywords: preBibisect, regression
Depends on:
Blocks:
 
Reported: 2020-10-31 14:05 UTC by Cajetan Bouchard
Modified: 2023-12-01 11:21 UTC (History)
5 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 Cajetan Bouchard 2020-10-31 14:05:59 UTC
Description:
The content of a cell that is being edited a cell in Calc, will appear in a new Sheet after clicking on the + button to create a new Sheet.

Steps to Reproduce:
1. Created a new spreadsheet document with Calc
2. Click any cell in in Sheet1 (i.e. C6)
3. Type something (i.e. 1)
3.1 (Do not press enter)
4. With your mouse, click on the + button on the left of the Sheet1 tab (at the bottom of the Calc window)
5. Notice that the content of the cell now contains what you typed in Sheet1 (i.e. Cell C6 of Sheet2 has 1)

Actual Results:
The text that was being edited in a sheet is now present in the new sheet (same cell)

Expected Results:
The text that was being edited should stay in the proper sheet and the new sheet should be completely empty.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.3.1 (also reproduced on 7.0.1.2)
Environment: CPU threads: 8; OS: Linux 5.6 (also reproduced on CPU threads: 4)
User Interface: UI render: default; VCL gtk3
Locale: en-CA (en_CA.UTF-8); UI: en-US
Misc: Calc: threaded
Comment 1 Martin Srdoš 2020-11-20 15:21:22 UTC
Hello [user's name],

Thank you for reporting the bug. I can confirm that the bug is present in master.

Version: 7.1.0.0.alpha1+ (x64)
Build ID: 00e5c63c35307faacf76a5e2ca7953c4208244ed
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-US
Calc: CL

Also in

Verze: 4.1.0.1
ID sestavení: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155
Comment 2 Martin Srdoš 2020-12-23 12:31:49 UTC
This bug is present since version:
LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Comment 3 Justin L 2021-11-08 09:17:26 UTC
So I noticed that the contents are NOT included on sheet1. That is good. They are included on sheet2 as finalized - not as edit-in-progress.  (The selected cell in the new sheet is A1 - so there is no indication of the change that was being made - which may very well be off-screen.)
Comment 4 Justin L 2021-12-02 10:42:37 UTC
I'd say it is very reasonable to cancel any "in progress" work when creating a new sheet. A calc person should be able to do that very easily.
Comment 5 Justin L 2021-12-07 18:44:20 UTC
Taking a cue from SID_INPUT_CANCEL, it looks like at some point we should call SC_MOD()->InputCancelHandler().

ScTabControl::AddTabClick() looks like a good place to do that.
Comment 6 Justin L 2021-12-08 05:16:21 UTC
Proposed fix at http://gerrit.libreoffice.org/c/core/+/126501
Comment 7 Eike Rathke 2021-12-11 19:53:19 UTC
(In reply to Justin L from comment #4)
> I'd say it is very reasonable to cancel any "in progress" work when creating
> a new sheet.
I don't think so. If I was in the middle of editing a formula and inserted a sheet to reference it I would be annoyed if all my editing was gone. Rather accept the current input instead.
Comment 8 Justin L 2021-12-13 08:26:28 UTC
(In reply to Eike Rathke from comment #7)
>  Rather accept the current input instead.
It is fairly clear that a "topview" change needs to be explicitly cancelled or accepted. However, switching to a different application, print preview, spell check, etc. are considered as "accept". So accepting (rather than cancelling) would be consistent.

> If I was in the middle of editing a formula and inserted a
> sheet to reference it I would be annoyed if all my editing was gone.
In this case you are likely left with an error - since the editing will be accepted before the desired reference sheet is created. Plus it will be "out of sight" so you won't easily detect the "error". So this suggests that the topview needs to stay in edit/reference mode and neither commit nor cancel. [That sounds like a non-trivial effort.]
Comment 9 Justin L 2021-12-13 12:34:36 UTC
(In reply to Justin L from comment #8)
> In this case you are likely left with an error - since the editing will be
> accepted before the desired reference sheet is created. 
Nope - not true. This IsFormulaMode and so the editing is not finished at this point. It is still in "formula building" cell selection mode.
Comment 10 Justin L 2022-04-29 03:26:07 UTC
Interesting - no automatic merge notification even though the link to this bug report is intact. Anyway, the patch was merged.

tdf#137899 sc: accept any unfinished editing before adding sheet
https://gerrit.libreoffice.org/c/core/+/126501
Comment 11 Eike Rathke 2022-04-29 10:22:04 UTC
There appeared to be a BZ hickup/outage when the change was merged.
Comment 12 amoebasinger 2022-07-29 02:43:45 UTC
This problem is current in 7.3.4 and 7.2.7.  Windows 10 Pro
Comment 13 ady 2023-12-01 11:21:41 UTC
Verified as fixed since LO 7.4.