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.

Bug 131343 - weird undo behaviour when undoing change made by (all)arrow in diff view
Summary: weird undo behaviour when undoing change made by (all)arrow in diff view
Status: VERIFIED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Diff (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: diff-issues@utilities
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-27 21:16 UTC by Petr Cyhelsky
Modified: 2008-08-21 15:22 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Cyhelsky 2008-03-27 21:16:45 UTC
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
Comment 1 Maros Sandor 2008-07-16 14:59:52 UTC
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.
Comment 2 Vitezslav Stejskal 2008-07-17 08:50:10 UTC
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?
Comment 3 Miloslav Metelka 2008-08-05 10:31:36 UTC
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.
Comment 4 Maros Sandor 2008-08-18 15:46:09 UTC
f614ff20b67e
Comment 5 Quality Engineering 2008-08-19 06:00:20 UTC
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
Comment 6 Petr Cyhelsky 2008-08-21 15:22:31 UTC
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)