This is a spin-off of https://bugs.documentfoundation.org/show_bug.cgi?id=81435#c16 Use https://bugs.documentfoundation.org/attachment.cgi?id=157283 as the test case. Copied description (reformatted for readability): problem: the name-reference is changed on move, but not rechanged on undo. it's two issues, one for moving into one sheet, another for moving to another sheet, the steps to reproduce the issue are noted in the sheet, copied here: A) name references messed up by moving of content into the sheet and undo steps to reproduce 1. check name reference 'testfield_1' to sheet1.B2 (hit ctrl-F3), scope of reference: sheet1 2. move sheet1.B2:sheet1.B3 to sheet1.C2:sheet1.C3 (ctrl-X, ctrl-V) 3. check new name reference 'testfield_1' with target C2 and scope sheet1, in the lower part of the box 'ctrl-F3' the scope is announced as global! 4. undo move – ctrl-Z – ctrl-Z 5. check result in sheet1.B3: '=#NAME?' despite 'testfield_1' still defined, but pointing to $C$2 imho the change by the move should be undone by undo (if you undo the move by another move with exchanged source-target references are handeled correctly) B) name references messed up by moving of content to another sheet and undo steps to reproduce 1. check name reference 'testfield_1' to sheet1.B2 (hit ctrl-F3), scope of reference: sheet1 2. move sheet1.B2:sheet1.B3 to sheet2.B2:sheet2.B3 (ctrl-X, ctrl-V) 3. check new name reference 'testfield_1' with scope sheet2, 3a. check old reference with scope sheet1 remains, but now points to new location (on sheet2) 4. check result in sheet2.B3: '=#NAME?' 5. undo move – ctrl-Z – ctrl-Z 6. check sheet1.B3 result now '0', it still references to testfield_1 on sheet2 test by input number to sheet2.B2 7. remove name reference testfield_1 from sheet2 8. observe result in sheet1.B3 unaffected, 9. change value in sheet2.B2 10. observe sheet1.B3 still calculating with the removed reference (if you undo the move by another move with exchanged source-target references are NOT handeled correctly)
Scenario slightly changed: For A)3. the scope in the dialog is still Sheet1 as it should, not Global. For B)3. and B)4. the formula in Sheet2.B3 is =Sheet1.testfield_1 where testfield_1 with scope Sheet1 points correctly to $Sheet2.$B$2, nothing with scope Sheet2. For B)8. nope, deleting testfield_1 name results in #NAME? in Sheet1.B3 as it should. Similar B)9. and B)10. do not occur. Actual problems: A)5. after Ctrl+Z Ctrl+Z the testfield_1 name is gone. B)6. after Ctrl+Z Ctrl+Z the Sheet1 scope testfield_1 still points to $Sheet2.$B$2 instead of $Sheet1.$B$2
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b7eddf3e9c2db503dde632b35513844806be3c36 Resolves: tdf#148072 Restore sheet-local names for Undo of Cut It will be available in 7.4.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.
Pending review https://gerrit.libreoffice.org/c/core/+/135587 for 7-3
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/cf2963b07b85dbf789d2b55640214523cc38f963 Resolves: tdf#148072 Restore sheet-local names for Undo of Cut It will be available in 7.3.5. 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.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ae11a7ff790e413cd4053e1db931b3c72f8259bb tdf#148072: sc: Add UItest It will be available in 7.5.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.