Bug 160804

Summary: If the separator is different from the standard locale, stretching the determinant with the fill handle will change the separator and result in a different formula
Product: LibreOffice Reporter: nobu <tac725>
Component: CalcAssignee: Eike Rathke <erack>
Status: RESOLVED FIXED    
Severity: normal    
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
Whiteboard: target:24.8.0
Crash report or crash signature: Regression By:
Attachments: sample file
sample file within macro

Description nobu 2024-04-24 09:24:55 UTC
Description:
If the separator is different from the standard locale, stretching the determinant with the fill handle will change the separator and result in a different formula.

Steps to Reproduce:
1. Open new calc
2. Input "={1|2|3}" in [A1]
("={1;2;3}" in Japan-Locale)
3. [A1, A2, A3] -> [1, 2, 3]
4. Select Matrix [ Ctrl + / ]
5. Expand Matrix to Row-5 with Fill-Handle (small icon in Help Page).

Actual Results:
in Japan Locale
6. [A1 ... A5] are All [ 1 ]
(Array Formula is Changed to "={1,2,3}" in Japan-Locale)

Expected Results:
in English Locale
6. [A1 ... A5] are [ 1, 2, 3, #N/A, #N/A ]


Reproducible: Always


User Profile Reset: No

Additional Info:
[Help pages related to this]
Adjusting an Array Range
https://help.libreoffice.org/latest/en-US/text/scalc/01/04060107.html?#hd_id3154834

Reproducible with
Version: 7.3.7.2 (x64) / LibreOffice Community
Build ID: e114eadc50a9ff8d8c8a0567d6da8f454beeb84f
CPU threads: 4; OS: Windows 10.0 Build 10240; UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL

Reproducible with
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d76f1877f699c91f5e4a020641c6d65064bfb997
CPU threads: 4; OS: Windows 10.0 Build 10240; UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: threaded
Comment 1 nobu 2024-04-24 09:26:01 UTC
Created attachment 193834 [details]
sample file
Comment 2 ady 2024-04-24 21:28:57 UTC
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ea43cbbb7371a743f470d949762a0e92f196e652
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (es_AR); UI: en-US
Calc: CL threaded


_My_ settings are probably not typical:

* Array Row separator: semicolon (";")
* Array Column separator: vertical bar ("|" hex 7c, dec 124)


1. A1: ={1;2;3} [ENTER]

1.1. Array result:

A1: 1
A2: 2
A3: 3

2. Select A1:A3 (the whole array).

3. Expand the array to add one row, A1:A4.

3.1. Array result:

A1: 1
A2: 1
A3: 1
A4: 1


4. Expand the array to add one row, A1:A5.

4.1. Array result:

A1: 1
A2: 2
A3: 3
A4: #N/A
A5: #N/A



5. Expand the array to add _two_ rows, A1:A7.

5.1. Array result:

A1: 1
A2: 1
A3: 1
A4: 1
A5: 1
A6: 1
A7: 1


6. Expand the array to add one row, A1:A8

4.1. Array result:

A1: 1
A2: 2
A3: 3
A4: #N/A
A5: #N/A
A6: #N/A
A7: #N/A
A8: #N/A



I can even reduce the size of the array; the amount of rows (plus or minus) are not a factor.

The factor is: one time I get "ones", the next time I get the original array plus #N/A (as much as needed to fulfill the new size of the array), and then the cycle repeats.

I can also replicate this cycle when expanding the array from rows to multiple columns. The difference is that the "ones" are expanded to "twos", and so on (according to number of columns) and then #N/A's and then the cycle repeats.
Comment 3 ady 2024-04-24 23:00:04 UTC
(In reply to ady from comment #2)

> _My_ settings are probably not typical:
> 
> * Array Row separator: semicolon (";")
> * Array Column separator: vertical bar ("|" hex 7c, dec 124)
> 
> 
> 1. A1: ={1;2;3} [ENTER]

Of course that for older versions, the introduction of the array (formula) needs to be performed by [CTRL]+[SHIFT]+[ENTER] (instead of the sole [ENTER]). In newer versions, Calc automatically recognizes this as an array even when only using [ENTER].

When using CSE, I can reproduce the same behavior I described in comment 2 with LO 3.3 too.

Before setting this report to "inherited", I would rather have confirmation that what I described in comment 2 is indeed the same problem that is (apparently) reported in comment 0 (because I am not sure, considering the differences in my results).
Comment 4 nobu 2024-05-16 08:55:08 UTC
Created attachment 194146 [details]
sample file within macro

> In newer versions, Calc automatically recognizes this as an array even when only using [ENTER].

However, I have not seen any documentation outside of the release notes that states that [Ctrl + Shift + Enter] may not be necessary.

______________________________________________________
I apologise if my description is not clear.

A macro has been created to show what happens to the fill down matrix when the delimiter is different from the system.
Check the changes in the system formula.
3-Types -- 1;2;3 , use Filter Function , use Sequence Function
Comment 5 Commit Notification 2024-05-19 17:26:47 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d4ae5abb4d00cc8adb3c45a9410fc71e56211c46

Resolves: tdf#160804 sc: ResizeMatrix: Use document grammar

It will be available in 24.8.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 6 Eike Rathke 2024-05-19 17:27:16 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/167817 for 24-2