fix: restore individual cell values on undo for multi-cell paste#2570
fix: restore individual cell values on undo for multi-cell paste#2570ghiscoding wants to merge 3 commits intomasterfrom
Conversation
|
@zewa666 would you mind providing your point of view to this PR, I literally looked at all the old opened SlickGrid issues and vibe coded fixes for a few of them (using copilot for free). Then looked at reimplementing it in here in Slickgrid-Universal at work with copilot again (it also confirmed that we also have that problem here too). It's supposed to fix issue mentioned in 6pac/SlickGrid#917 and I asked copilot to provide all the steps to reproduce. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2570 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 196 196
Lines 24982 24984 +2
Branches 8826 8825 -1
=======================================
+ Hits 24982 24984 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
angular-slickgrid
aurelia-slickgrid
slickgrid-react
slickgrid-vue
@slickgrid-universal/angular-row-detail-plugin
@slickgrid-universal/aurelia-row-detail-plugin
@slickgrid-universal/react-row-detail-plugin
@slickgrid-universal/vue-row-detail-plugin
@slickgrid-universal/binding
@slickgrid-universal/common
@slickgrid-universal/composite-editor-component
@slickgrid-universal/custom-footer-component
@slickgrid-universal/custom-tooltip-plugin
@slickgrid-universal/empty-warning-component
@slickgrid-universal/event-pub-sub
@slickgrid-universal/excel-export
@slickgrid-universal/graphql
@slickgrid-universal/odata
@slickgrid-universal/pagination-component
@slickgrid-universal/pdf-export
@slickgrid-universal/row-detail-view-plugin
@slickgrid-universal/rxjs-observable
@slickgrid-universal/sql
@slickgrid-universal/text-export
@slickgrid-universal/utils
@slickgrid-universal/vanilla-bundle
@slickgrid-universal/vanilla-force-bundle
commit: |
|
oh thats a very good catch. will check it out tomorrow |

fixes an old issue opened in SlickGrid (6pac) project: 6pac/SlickGrid#917
vibe coded a fix with Copilot
Description
Fixes issue mentioned in SlickGrid, where undoing a multi-cell paste operation in
CellExternalCopyManagerincorrectly restores all cells to the same value instead of their individual previous values.The Problem Explained
The
oneCellToMultiplepaste feature allows users to copy a single cell and paste it to multiple cells at once (like Excel). However, when undoing this operation, the bug causes all pasted cells to be restored to the same previous value instead of each cell being restored to its own individual previous value.Root Cause
When pasting a single cell value to multiple cells (
oneCellToMultiple), the undo function was incorrectly retrieving the old value. It usedoldValues[0][0]for all cells instead ofoldValues[y][x - xOffset], causing all cells to be restored to the first cell's previous value.Additionally, the undo function was not properly tracking
xOffsetfor hidden columns, unlike the execute function which handles this correctly.Detailed Reproduction Steps
Setup Initial Grid Values:
Copy Single Cell:
Paste to Multiple Cells:
Undo the Paste:
Solution
oneCellToMultipleconditional from the undo functionxOffsettracking to handle hidden columns correctly (consistent with the execute function)oldValues[y][x - xOffset]Impact