This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version: NetBeans IDE Dev (Build 200803251204) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb) observed: When in diff tab with more than one difference and after pressing the arrow which reverts all changes to the original, the undo wont revert to the previous state(before clicking on the arrow), but instead it clears the right half of the diff tab. U must click on undo again for the desired effect (return to the state before clicking on the arrow) - therefore u have to undo TWICE to undo ONE change. expected: after clicking undo ONCE the diff tap returns to the state before clicking on the (revert all differences)arrow steps to reproduce: while working with some versioned file make multiple changes and invoke the diff view -> click on the arrow(under the fraction indicating the number of current difference/total differences) -> undo
We do a single operation called document.replace() but this translates to two steps internally (delete, insert) which in turn undo one by one. Reassigning to editor for evaluation.
Well, the javadoc for AbstractDocument.replace says that it's up to the implementors to choose whether they will treat this operations as a pair of remove-insert or as a single atomic (undoable) operation. The netbeans editor chose the former. I'm not sure how much crucial this is and if changing this semantic would break something else. Let's see what Mila has to say about this. On the other side, could the diff's revert operation use document.atomicLock/Unlock to coalesce the changes and make them undoable altogether?
If you would wrap the operations with NbDocument.runAtomic() then there would be just a single undo edit so the mods would be undone together.
f614ff20b67e
Integrated into 'main-golden', available in build *200808190201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/f614ff20b67e User: Maros Sandor <msandor@netbeans.org> Log: #131343: Wrapping remove and insert operations into an actomic action
verified on: Product Version: NetBeans IDE Dev (Build 200808210201) Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b14 System: Windows Vista version 6.0 running on x86; Cp1250; cs_CZ (nb)