Bug 153539 - EDITING Some Calc functions get extra leading space character every time the formula is edited (same with save + reload)
Summary: EDITING Some Calc functions get extra leading space character every time the ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Formula Calc-Function
  Show dependency treegraph
 
Reported: 2023-02-10 22:29 UTC by ady
Modified: 2023-03-19 08:57 UTC (History)
2 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 ady 2023-02-10 22:29:34 UTC
1. New Calc document (using comma as argument separator in the following steps)
2. A1: 1
3. C1: =AND(A1,B1)  (do not press [ENTER] yet)
4. ENTER, ArrowUp, F2, Backspace, ENTER
5. In C1, add (at least) one space character between the function name and the first opening bracket:
 C1: =AND (A1,B1) (and [ENTER])
5.1. Go back to focus on C1 (i.e. click once on C1). Note that one additional space character was also automatically added before the function name: "= AND (A1,B1)".
6. ENTER, ArrowUp, F2, Backspace, ENTER
7. ENTER, ArrowUp, F2, Backspace, ENTER
8. ENTER, ArrowUp, F2, Backspace, ENTER
9. ENTER, ArrowUp, F2, Backspace, ENTER

Now it is clear that between the equal sign and the function name "AND", (what seems to be) a space character is being automatically added for each edition. (Why? What for? What is Calc trying to correct, or enhance, or compensate for? Anyway...)

To trigger the behavior, step 5 above is the key.

The specific function, "AND" in this case, is semi-circumstantial. The same behavior can be seen with "OR" too, but not with XOR, IF, SUM...

Tested in:
Version: 7.4.5.1 (x64) / LibreOffice Community
Build ID: 9c0871452b3918c1019dde9bfac75448afc4b57f
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: default; VCL: win
Locale: en-US (es_AR); UI: en-US
Calc: CL

Also tested in:
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9d44236a62bf59d120dda89924d0d1407b2bd52b
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (es_AR); UI: en-US
Calc: CL threaded

Repro also by:
 https://listarchives.libreoffice.org/global/users/2023/msg00046.html
Comment 1 Stéphane Guillou (stragu) 2023-02-25 07:46:37 UTC
Reproduced:

Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: c21113d003cd3efa8c53188764377a8272d9d6de
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

No need for the final ENTER in each step from 6 to 9.

I confirm that any kind of edit to the formula adds an extra space between the equal sign and the formula name, but only when there is a space between the formula name and the opening parenthesis. E.g., I could add extra elements (or remove them) to the formula after the function, to the same effect.
Also, reopening/reloading the file also adds one extra leading space. You can test doing Ctrl + S then File > Reload.

I can reproduce the same behaviour in 6.0, although back then, a space would be added both before *and* after the formula name:

Version: 6.0.0.3
Build ID: 64a0f66915f38c6217de274f0aa8e15618924765
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
Locale: en-AU (en_AU.UTF-8); Calc: group

Finally, in OOo 3.3, the spaces would be added before and after the formula name even without changing the formula. Entering in edit mode is enough.

OpenOffice.org 3.3.0
OOO330m20 (Build:9567)
Comment 2 Eike Rathke 2023-02-28 16:01:02 UTC
Note this is _only_ for the AND() and OR() functions and results from a twist to still support the legacy infix notation. That should not be used, but.. to get rid of we'd need to convert infix notation to function parameters.
Comment 3 Eike Rathke 2023-02-28 16:06:39 UTC
I think this is a duplicate but I didn't find the other bug.
Comment 4 ady 2023-03-19 08:57:23 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)

> No need for the final ENTER in each step from 6 to 9.

Sorry about that.

...
5. In C1, add (at least) one space character between the function name and the first opening bracket:
 C1: =AND (A1,B1) (and [ENTER])
5.1. [ArrowUp] to focus on C1 again. Note that one additional space character was also automatically added before the function name: "= AND (A1,B1)".
6. F2, Backspace, ENTER
7. ArrowUp, F2, Backspace, ENTER
8. ArrowUp, F2, Backspace, ENTER
9. ArrowUp, F2, Backspace, ENTER


> 
> I confirm that any kind of edit to the formula adds an extra space between
> the equal sign and the formula name, but only when there is a space between
> the formula name and the opening parenthesis. E.g., I could add extra
> elements (or remove them) to the formula after the function, to the same
> effect.
> Also, reopening/reloading the file also adds one extra leading space. You
> can test doing Ctrl + S then File > Reload.
> 
> I can reproduce the same behaviour in 6.0, although back then, a space would
> be added both before *and* after the formula name:
> 
> Version: 6.0.0.3
> Build ID: 64a0f66915f38c6217de274f0aa8e15618924765
> CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
> Locale: en-AU (en_AU.UTF-8); Calc: group
> 
> Finally, in OOo 3.3, the spaces would be added before and after the formula
> name even without changing the formula. Entering in edit mode is enough.
> 
> OpenOffice.org 3.3.0
> OOO330m20 (Build:9567)

The minor differences perhaps might indicate that at some point there was some effort to improve the behavior(?).

Adding See Also bug 116040 involving same functions AND() and OR().