We have a problem with the UNDO function in LPEX. It works differently than in (e.g.) MS_Word. As a consequence, it happens that by undoing code updates, the user may inadvertently reintroduce a piece of code which he previously deleted intentionally. See the use case.
Below is the communication we have done in a PMR which initially discussed the problem with IBM, but which was closed because it was considered "works as designed". We don't agree with the design.
Hi Bart,
I want to update you with the findings from development on PMR 09951,300,624 - Undo in LPEX Editor. As I suspected, the product is working correctly by design.
Development's response:
I have found in the code the following
Undo.prepareForRecord()
if (_currentUndo != null)
{
// something has been undone, create a new undoable change for the undo
// System.out.println(">>> new UndoableChange(view,_currentUndo)");
new UndoableChange(view, _currentUndo);
_currentUndo = null;
}
Lpex simply maintains a undo list and undo actions themselves are put into this list
This gives you the ability with repeated Undo commands to go back, one change at a time until the file was loaded. Then with repeated Redo commands you can see every change that happened (including any Undo commands).
If an Undo command would pop a change off of the list, then this complete, unlimited change history would not be possible.
I have debugged the code and I agree that the algorithm is a little non-standard but it does work and has been working this way for a long time. So yes, this is by design.
The following is a step by step illustration of the algorithm and is probably not worth following except for those really interested. The executive summary above, should be sufficient for most.
In particular when a set of undos is followed by a new change, this new state does not pop off all of the changes up until now but merely adds a new state to the end of all of the states up until now.
Editor = what you see in the editor after adding the first 3 lines
1
2
3
Undoable List: = the data structure remember all changes that have happened so far so that we can traverse it by Undo and Redo.
<+1>
<1 ''='1'>
<+2>
<2 ''='2'>
<+3>
<3 ''='3'>
<-----
So the undoable list is something like the above, where
<+element> is adding a line (element in Lpex parlance)
<element old-content=new-content> for the given element replace the old-content with the new-content
<---- is the current position within the list
~<*> mean undoing the specified action *
Now the user presses Undo
Editor
1
2
Undoable List:
<+1>
<1 ''='1'>
<+2>
<2 ''='2'>
<+3>
<-----
<3 ''='3'>
lastUndone = <3 ''='3'>
Now the user enters a '4' on element number 3
This is where Lpex does its unique algorithm. It takes that last undone action and wrappers it as undoable action. Then it adds the new change at the end of the list of undoable changes
Editor
1
2
4
Undoable List:
<+1>
<1''='1'>
<+2>
<2 ''='2'>
<+3>
<3 ''='3'>
~<3 ''='3'> ====== this means that the Undo of the change i.e. replace the '3' with the ''
<3 ''='4'>
<-----
So now you can walk through the undoable list one at a time and get
Editor - undoing <3 ''='4'>
1
2
Editor - undoing ~<3 ''='3'> ====== The undo of the undo of the change i.e. replace the '' with the '3'
1
2
3
Editor - undoing <3 ''='3'>
1
2
Editor - undoing <+3>
1
2
Editor - undoing <2 ''='2'>
1
etc.
You are probably sorry you asked.
But this is the Lpex Undo algorithm.
Kind regards,
Dan Shaver
IBM L2 Rational Software Support
Rational Developer for System z
Rational Transformation Workbench (RTW)
WebSphere Studio Asset Analyzer (WSAA)
Rational Asset Analyzer (RAA)
dshaver@us.ibm.com (919)254-7030
******************************************************************************************
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender or the postmaster@socmut.be
******************************************************************************************
Bezoek onze website : http://www.socmut.be Visitez notre site internet : http://www.mutsoc.be
******************************************************************************************
Due to processing by IBM, this request was reassigned to have the following updated attributes:
Brand - Servers and Systems Software
Product family - Programming Languages
Product - Developer for System z
For recording keeping, the previous attributes were:
Brand - Rational
Product family - Design & development
Product - Developer for System z
This RFE is addressed with the new editor support provided in last release of RDz. Thanks.
The function requested in this RFE is addressed with the new editor support provided in last release of RDz. Do you agree ?
This RFE is consistent with our strategy and product roadmap and IBM is continuing to evaluate.