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 188409 - Undo undoes too much
Summary: Undo undoes too much
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 7.0
Hardware: PC All
: P1 normal with 1 vote (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
: 188893 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-06 16:21 UTC by Jesse Glick
Modified: 2010-07-31 03:31 UTC (History)
4 users (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 Jesse Glick 2010-07-06 16:21:04 UTC
Not sure offhand if this exists also in 6.9, but I think I have seen it only in dev builds; may be related to jtulach's work on UndoRedo.Provider. If I have made some edits to a file, perhaps saved it, and then accidentally type another bogus character and press Ctrl-Z, *two* edits are undone: my bogus change, and also the other unrelated last edit which was intentional. Ctrl-Y restores both edits. There is no apparent way to just undo the last edit.
Comment 1 Vladimir Voskresensky 2010-07-08 12:59:59 UTC
Very annoying regression, can someone evaluate, please?
Comment 2 Vladimir Voskresensky 2010-07-08 13:00:20 UTC
Product Version: NetBeans IDE Dev (Build 100708-a516ca9891a9)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
Comment 3 rip_pit 2010-07-13 22:42:10 UTC
(In reply to comment #0)
> Not sure offhand if this exists also in 6.9, but I think I have seen it only in
> dev builds; may be related to jtulach's work on UndoRedo.Provider. If I have
> made some edits to a file, perhaps saved it, and then accidentally type another
> bogus character and press Ctrl-Z, *two* edits are undone: my bogus change, and
> also the other unrelated last edit which was intentional. Ctrl-Y restores both
> edits. There is no apparent way to just undo the last edit.

This annoying thing appeared to me only after i installed the latest dev build.
Product Version = NetBeans IDE Dev (Build 2010-07-12_20-18-52 )
Operating System = Windows XP version 5.1 running on x86 SP3
Java; VM; Vendor = 1.6.0_20
Runtime = Java HotSpot(TM) Client VM 16.3-b01

I can confirm it doesn't exists in 6.9.0
Comment 4 Jaroslav Tulach 2010-07-15 08:39:20 UTC
You can type one more character and then do undo. This will undo both, right?
Comment 5 Vladimir Voskresensky 2010-07-16 06:26:07 UTC
I use dev builds and it's more and more difficult to accept that undo doesn't work reliably at all. 
Doing 2 independent modifications (one fine and one incorrect) I'm loosing my work with current "undo" and have to "redo" all and delete what I wanted to "undo" manually
Comment 6 schkovich 2010-07-16 16:07:54 UTC
PHP build
Product Version: NetBeans IDE 6.9.1 Dev (Build 201006282301)
Java: 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01
System: Linux version 2.6.32-23-generic running on amd64; UTF-8; en_US (nb)

I've been intensively working in last few days and I did not notice nor I can reproduce such behavior.
Comment 7 karmaflute 2010-07-19 06:24:52 UTC
NetBeans IDE Dev (Build 201007180001) and I have this same issue. Undo is undoing too much.
Comment 8 David Strupl 2010-07-23 12:35:52 UTC
I will try to have a quick look before Mila is back from vacation.
Comment 9 David Strupl 2010-07-23 13:11:17 UTC
Reverting Jarda's changes did not fix it (at least I think it did not). Let's wait for Mila ...
Comment 10 Miloslav Metelka 2010-07-28 07:56:06 UTC
I'm testing in a build from 100727 and it seems to work fine (undos not merged both without an intermediate Save or with it).
Could anyone possibly provide steps to reproduce in current builds? Thanks.
Comment 11 Miloslav Metelka 2010-07-28 08:29:56 UTC
I'm now able to reproduce the problem.
Comment 12 tkrd_oiax 2010-07-29 13:36:47 UTC
*** Bug 188893 has been marked as a duplicate of this bug. ***
Comment 13 Miloslav Metelka 2010-07-30 13:20:50 UTC
I have finally found a cause of the problem.
Steps:
1) Have a java file with a line with an existing text e.g. "private int i = 5;"
2) Modify "private" to "privatex"
3) Save file
4) Modify "int" to "inty"
5) Undo. Strangely both "int" and "private" words are undone at once.

Reason:
BeforeSaveTasks requests BaseDocument.markAtomicEditsNonSignificant() since it
must merge with any previous edits already present in an undo manager.
Unfortunately if there's no actual modification from trailing whitespace
removal then an empty BD.AtomicCompoundEdit with nonSignificant flag turned on
will stay in the BaseDocument and it will be picked by a first after-save
operation which will then merge with before-save edit.

http://hg.netbeans.org/jet-main/rev/025f14166ef5
Comment 14 Quality Engineering 2010-07-31 03:31:10 UTC
Integrated into 'main-golden', will be available in build *201007310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/025f14166ef5
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #188409 - Undo undoes too much.