Bug 114038 - Range operations setting the values of previously empty cells can not be undone
Summary: Range operations setting the values of previously empty cells can not be undone
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
Keywords: preBibisect, regression
Depends on:
Blocks: Undo-Redo
  Show dependency treegraph
Reported: 2017-11-24 22:54 UTC by Mátyás Jani
Modified: 2018-11-27 03:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

small spreadsheet demonstrating the bug (10.55 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-11-24 22:54 UTC, Mátyás Jani

Note You need to log in before you can comment on or make changes to this bug.
Description Mátyás Jani 2017-11-24 22:54:54 UTC
Created attachment 137971 [details]
small spreadsheet demonstrating the bug

In LibreOffice Calc BASIC macros setting the values of empty cell ranges can not be undone. The new values will remain in the previously empty cells after pressing undo.

Tested functions, undo does not work after these:
targetRange.DataArray = sourceRange.DataArray

Steps to reproduce:
1. create a macro that sets the values in a range of empty cells using the above functions
2. execute the macro
3. press undo

Expected behaviour: the cells content will be erased after undo, restoring their original state.
Actual behaviour: the cells content does not change, the values set by the macro remains there.

See the attached .ods file.

Tested on:
Build ID: 5.4.3-2
CPU threads: 6; OS: Linux 4.13; UI render: default; VCL: kde4; 
Locale: hu-HU (hu_HU.UTF-8); Calc: group
Comment 1 Mátyás Jani 2017-11-24 23:15:33 UTC
Workaround: set the target cells of the range to empty string before applying the range operation. Do it in an undo context, to have enough undo steps to undo the whole action in one.

Something like this:

	undo = ThisComponent.UndoManager
	undo.enterUndoContext("Copy range action")
	' clear target range, undo workaround
	for row = 4 to 8
		for col = 0 to 1
			sheet.getCellByPosition(col, row).string = ""
		next col
	next row
	copyRange = sheet.getCellRangeByName("A1:B4")
	pasteRange = sheet.getCellRangeByName("A5:B8")
	pasteRange.DataArray = copyRange.DataArray

(Note, clearing the target range with range operation will not work.)
Comment 2 Buovjaga 2017-11-26 18:45:12 UTC
Regression from 3.3, but seen already in 3.5, so not bibisectable.

Severity minor per existing workaround.

Win 10
LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735

Arch Linux 64-bit
Build ID: 008673c23db0c812eb0b48a1c29ab88b48aaa867
CPU threads: 8; OS: Linux 4.13; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group threaded
Built on November 23rd 2017

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-
Comment 3 QA Administrators 2018-11-27 03:43:21 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team