Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 21476

Summary: [preference] Maximum number of "Undo"s
Product: [Eclipse Project] Platform Reporter: Silvano Maffeis <silvano.maffeis>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: alvin, billy.biggs, bogofilter+eclipse.org, david_williams, maffeis, markus.kell.r, max.gilead, mikehoeffner, mlists, nikolaymetchev, preuss, richieholes
Version: 2.0   
Target Milestone: 3.1 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Change undo limit to 1000
none
Undos stored on disk none

Description Silvano Maffeis CLA 2002-07-11 05:43:59 EDT
After hitting Undo a couple of times I got stuck
and could not finish undoing a series of changes I did.
So I tried to see where I can configure the max. number of undoable
changes somehow. I checked the Preferences as well as the plugin.xml 
files but didn't find anything suitable.

Would be good to be able to control the size of the undo
buffer through the Preferences menu.

Im Using R.2 (Build id: 200206271827).

Cheers,
Silvano
Comment 1 Nick Edgar CLA 2002-07-12 09:02:53 EDT
I assume you mean changes in the editor, not refactoring undos.
Comment 2 Silvano Maffeis CLA 2002-07-12 09:23:45 EDT
Yes, I meant in the editor. (Hi Kai, long time no see :-)
Comment 3 Alvin Thompson CLA 2002-11-07 16:10:15 EST
is anyone fixing this? i get bitten by this shallow undo buffer all the time...
Comment 4 Dani Megert CLA 2004-01-05 12:10:54 EST
The limit was probably not reached but the undo manager cleared the undo stack
upon save. This has been changed for 3.0 some time ago.

Please reopen if this is still a problem for using 3.0 M6 or higher.
Comment 5 Markus Keller CLA 2004-01-05 12:42:24 EST
For me, it's not fixed. The undo stack is still hardcoded to 25 levels, and I
also hit the limit from time to time. It's that rare situation where you forget
to save for some time and you know that the version from 10 minutes ago was
definitely better than the current one - but you can't reach back, since Local
History is only updated on save ...

How about an "Editor Undo Levels" text field in the Local History preference
page, where we can already increase Local History's memory?
Comment 6 snowl CLA 2004-01-05 17:28:27 EST
I have just tested with Eclipse 3.0 M6 and the limit is still 25. 

If the limit is to remain hardcoded I think it should be at least 200 
(preferably 1000+), but as Markus says ideally it would be a preference (maybe 
with unlimited as an option).
Comment 7 Dani Megert CLA 2004-01-06 03:25:01 EST
>I have just tested with Eclipse 3.0 M6 and the limit is still 25. 
I didn't say we changed it, did I? ;-)
Comment 8 snowl CLA 2004-01-24 11:13:09 EST
Created attachment 7553 [details]
Change undo limit to 1000

Hardly worth a patch really, but here's one against HEAD that changes the limit
to 1000.
Comment 9 Dani Megert CLA 2004-01-26 06:15:00 EST
Simply setting increasing the limit is not a good idea since this increases the
footprint.

We decided to offer a preference for the Text and Java editor with a hint that
this might increase the footprint.

Christof, this is for M8 and not M7.
Comment 10 Alvin Thompson CLA 2004-03-19 17:11:44 EST
ack! bit by this again! grr!  :P
Comment 11 Kai-Uwe Maetzel CLA 2004-03-26 11:34:47 EST
Changing milestone to M9.
Comment 12 Kai-Uwe Maetzel CLA 2004-03-26 11:36:45 EST
.
Comment 13 Kai-Uwe Maetzel CLA 2004-03-29 07:22:45 EST
*** Bug 56557 has been marked as a duplicate of this bug. ***
Comment 14 Dani Megert CLA 2004-05-03 09:25:27 EDT
*** Bug 60742 has been marked as a duplicate of this bug. ***
Comment 15 Kai-Uwe Maetzel CLA 2004-05-27 09:16:14 EDT
Removing mile stone. We didn't make. Blame us, but this will not happen for 
3.0.
Comment 16 Max Gilead CLA 2004-10-04 11:50:56 EDT
Is anyone working on this? A lot of exciting changes are done with 3.1 and this
would be very important addition, too. Pretty pretty please ;)
Comment 17 Mark McConkey CLA 2004-10-04 13:49:50 EDT
Doh! this one got me again the other night.

Even if it were only to increase the hard coded value from 25 to 1000 it would
be better.  Even raising it to 100 would be a vast improvement.

Your work is greatly appreciated.
Comment 18 Max Gilead CLA 2004-11-02 09:58:19 EST
[desperate mode on]

Please!!!

It's SO annoying to be forced to go back to local history SO often because of
this small undo buffer problem.

If it's so big change to make it configurable PLEASE just increase default
number of undo levels to at least 100. But not 25 (and Eclipse counts every
single bit of editor activity as undo entry, 25 levels is sometimes mere 5 lines
of actual text!!)
Comment 19 Justin CLA 2004-11-29 19:29:50 EST
I can't believe this bug is almost 2 & 1/2 years old and still not resolved. I
don't understand why there isn't an option to set the undo history limit?

I really like eclipse but as a new Java developer this feature-lack is killing me.
Comment 20 Sriram Melkote CLA 2004-11-29 21:02:16 EST
This is soooo weird that a product like eclipse will have this stupid bug. I
guess this just shows nobody looks at bug databases. Yes, yes, it's a one line
patch, but for a lot of folks who use eclipse (rather than develop on it), it's
a whole lot more work to pull, change 1 line and recompile instead of getting
binaries. Please please expose this in some options screen!!
Comment 21 Silvano Maffeis CLA 2004-11-30 01:00:30 EST
It's now more than two years old and it's biting me about once a week ...
Comment 22 snowl CLA 2004-12-06 16:20:35 EST
Created attachment 16401 [details]
Undos stored on disk

This patch will store undo commands on disk. This will allow an unlimited undo
stack without significant footprint increase. The stack still exists in memory,
but it only contains offsets to a file that contains the actual contents of the
undos. An LRU of 25 undos is held in memory. 

Memory use is 8 bytes per undo command. I estimate this will result in 32k RAM
per 1000 lines written. The size/type of the undo does not alter the amount of
memory used (except for the cache) only the number of them.

New undos are added to the end of the file, no attempt is made to recover space
from obsolete undos until Eclipse is restarted.

This patch also fixes bug 49553 (Undo should work one line at a time). Look
there for more details of that part. 

I'm not sure how to get a java.io.File for the .metadata directory. I used

Platform.getLocation().append(".metadata")

but I don't know if that is correct.
Comment 23 Justin CLA 2004-12-07 18:31:24 EST
Sounds good. Are there instructions on how we (the users) would apply the patch?
Is it part of the latest slipstream releases? If not, will it be in an official
release?
Comment 24 snowl CLA 2004-12-08 17:02:53 EST
Unless you're concerned about memory footprint don't bother with my most 
recent patch. Just change 

src/org/eclipse/jface/text/source/SourceViewerConfiguration.java

in the org.eclipse.jface.text plugin. There's a 25 in there somewhere; change 
it to whatever you want.

I wouldn't hold your breath about this getting fixed in an official release. I 
have submitted 5 or 6 patches/suggested fixes over the last 18 months and only 
a couple of the bugs have been fixed and never with the patches I submitted 
and only half fixed in one case. 

I can empathise. Fixing bugs sucks. Fixing bugs with other people's code sucks 
a lot. But then having to patch your IDE every time you upgrade sucks too.
Comment 25 Leopold Welsch CLA 2004-12-09 03:44:13 EST
Hm', I'm not quite familar with how to use the submitted patch. First ofF all
it's a CVS-patch, and do NOT know how to retrieve the full code. Next, don't
know where to store the Java-File and what to replace.

Wouldn't it be possible to be *little* bit more eloquent, how to create a
personal new 'jfacetext.jar'. Would be great!
Comment 26 Justin CLA 2004-12-09 10:47:25 EST
Instructions for setting up CVS are located here:
http://dev.eclipse.org/cvshowto.html

I've gotten so far as to check out the jfacetext tree and modify the source. I
can't seem to figure out or find instructions on how to build a new jar file
from the source, though.
Comment 27 Dani Megert CLA 2004-12-10 10:04:58 EST
Platform UI is working on an Undo/Redo framework which Platform Text will adopt.

For details see bug 37716 and:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-ui-home/R3_1/undo-redo-proposal/undo-redo%20support.html

Once this is in place we will migrate to it. If this will not make it into 3.1
then we will provide a shared text editor preference for the Maximum number of
"Undo"s.
Comment 28 ilias CLA 2004-12-10 14:17:21 EST
Comment 27 looks very promising.

But after 2 years, the team should have the gentleness to provide a preliminary
official patch in a convenient _binary_ form (e.g. *.jar), thus the users have a
simple solution.

Alternatively, the author of Comment 22 could maybe provide his 2 solutions as a
*.jar with some instructions.

It is not adequate that every intrested users goes into the CVS battle to solve
this very essential issue.
Comment 29 Gregory A. Swarthout CLA 2005-03-08 11:38:25 EST
I bump into this issue almost daily.  Would really like to be able
to set the number of undo's.
Comment 30 Dani Megert CLA 2005-03-24 10:00:54 EST
Happy Easter!

This can be configured on the Workbench > Editors > Text Editors preference page

Fixed.
Available in builds > 20050324.
Comment 31 Tobias Widmer CLA 2005-03-30 05:45:25 EST
Verified
Comment 32 Dani Megert CLA 2005-04-24 10:11:09 EDT
*** Bug 92509 has been marked as a duplicate of this bug. ***