Skip to content

Fix array misalignment bug in copy/paste functions#56

Open
dagangtj wants to merge 1 commit intoInfiniteSearchSpace:masterfrom
dagangtj:fix-array-misalignment
Open

Fix array misalignment bug in copy/paste functions#56
dagangtj wants to merge 1 commit intoInfiniteSearchSpace:masterfrom
dagangtj:fix-array-misalignment

Conversation

@dagangtj
Copy link
Copy Markdown

Problem

The copy and paste functions in the editor window were causing array misalignment due to incorrect index order in the for loops.

Root Cause

In jMenuEditor.java, both the "Copy To Clip" and "Paste From Clip" functions were using [j][i] to access array elements while the loops iterated with i as the outer index and j as the inner index.

This caused:

  • Leftmost column to wrap to rightmost column (grid shift by -1,0)
  • Rightmost column to then shift by (0,-1)

Solution

Changed array access from [j][i] to [i][j] to match the loop iteration order.

Lines changed:

  • Line 75: TF.pp[j][i].setVal(intAr[j][i][0])TF.pp[i][j].setVal(intAr[i][j][0])
  • Line 88: intAr[j][i][0] = TF.pp[j][i].valintAr[i][j][0] = TF.pp[i][j].val

Fixes #50

Fixed index order in jMenuEditor.java copy and paste operations.
Changed from [j][i] to [i][j] to match loop iteration order.

This resolves the issue where:
- Leftmost column was wrapped to rightmost column (grid shift by -1,0)
- Rightmost column was then shifted by (0,-1)

Fixes InfiniteSearchSpace#50
@dagangtj
Copy link
Copy Markdown
Author

Hi, this is a straightforward bug fix. Let me know if you need any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG BOUNTY] (USD-equivalent) $15 of Bitcoin to fix this array misalignment bug

1 participant