Bug 167691 - EDITING: Number pattern continuation at dragging is a bit broken
Summary: EDITING: Number pattern continuation at dragging is a bit broken
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: AutoFill
  Show dependency treegraph
 
Reported: 2025-07-28 00:33 UTC by vic
Modified: 2025-07-29 20:14 UTC (History)
0 users

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 vic 2025-07-28 00:33:32 UTC
Description:
See the Steps below

Steps to Reproduce:
Insert each of the following sequence of numbers, in a row or column, then select each sequence and drag by the corner to continue the pattern:

1) 1,1

2) 1,empty,1,empty

3) 1,1,2,2 

4) 1,empty,1,empty,2,empty,2,empty 

5) 1

6) ab

Actual Results:
I show only the continuation of the sequence as produced by Calc:

1) 1,1,1,1...
OK

2) 2,empty,2,empty,3,empty,3,empty .... 
NOT OK, inconsistent

3) 2,2,3,3,3,3,4,4,4,4...
NOT OK, because inconsistent with initial "1,1" 

4) 2,empty,2,empty,3,empty,3,empty,3,empty,3,empty,4,empty,4,empty,4,empty,4,empty
NOT OK, as in 3)


5) 2,3,4
NOT OK, inconsistent with next, and because it's not a reference to expect to increase automatically by 1
 
6) ab,ab,ab


Expected Results:
1) 1,1,1,1...

2) 1,empty,1,empty,1,empty,1,empty .... 

3) 3,3,4,4,...

4) 3,empty,3,empty,4,empty,4,...

5) 1,1,1,...
I recognize that the case for this is more debatable.

6) ab,ab,ab,...



Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 2; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Saburo 2025-07-28 06:27:12 UTC
reproducible
Version: 25.8.0.1 (X86_64)
Build ID: 127f2cf27c25aaac008a1045ebfed22015cb3064
CPU threads: 4; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded

I think cases 2 and 5 can be handled by using the Ctrl key in combination.
Comment 2 vic 2025-07-28 17:51:43 UTC
Yes, with CTRL, you can force the selected sequence to repeat no matter what pattern it had inside.
But what I point out is that behaviour without CTRL is inconsistent, especially when the selection has 2 or more numbers.
Comment 3 vic 2025-07-29 20:14:29 UTC
To tackle the above, it's better to separate the cases with only numbers vs with numbers and empty cells. 

Thus I'll focus first on number-only patterns. Please let me know if I better submit a separate proposal for this. 

I have explored many common patterns & ideas. 
Here's a pattern rule that I think it's one of the simplest but also more powerful than what's currently in use: 

Start with the linear (arithmetic) pattern, indicated by 2 numbers that the users enters:
a, b
from which Calc infers d(delta)=b-a, to add to current number to get next, every time. 

Generalize it to 2 groups of equal count of numbers each. 
For instance, user enters 4 numbers, meant to be 2 groups of 2 each:
a1 a2 b1 b2
where now there are 2 deltas/changes, for each pairs of numbers in corresponding positions:
d1=b1-a1; d2=b2-a2
meant to be applied to numbers in current group to get the numbers of the next group. 

Some example patterns that are easily generated by such a rule:
p1: 1,3 => 5,7,9..             (groups of 1 number each, d=2)
p2: 1,1,1,3,3,3 => 5,5,5,7,7,7.. (groups of 3 numbers, d1=2, d2=2, d3=2)
p3: 1,3,5,1,3,5 => 1,3,5,1,3,5.. (groups of 3 numbers, d1=d2=d3=0)
p4: 1,2,3,2,4,6 => 3,6,9,4,8,12.. (groups of 3 numbers, d1=1,d2=2,d3=3)

You can see that this rule covers all patterns currently possible in Calc (periodic, w/CTRL, and "increase each by 1" ) and much more. 

In particular, p2 is not currently possible in calc by pattern continuation. 
I have encountered it in practice wanting to have: 2000,2000,2000,2000,2001,2001,2001,2001... 
I have noticed another user (https://bugs.documentfoundation.org/show_bug.cgi?id=157731) wanting a similar pattern with letters:
A,A,A,A,B,B,B,B,C,C,C,C...
which will be possible too, with my rule above, once Calc implements a way to increment letters, indefinitely 
(https://bugs.documentfoundation.org/show_bug.cgi?id=65198)

What if the user does not enter 2 groups of exactly same count? 
If 3 or more groups - then Calc can check the above still holds. 
If unequal groups => Calc can fall back to what it is doing now. 

The above rule can ge generalized to cases when empty cells are involved - but on this later. 

What do you think? Any chances to be implemented?