AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unlimited Undo In Text Editors

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Invalid User



Joined: 14 Feb 2005
Posts: 447
Location: Texas, Usa

PostPosted: Mon Sep 26, 2005 4:05 pm    Post subject: Unlimited Undo In Text Editors Reply with quote

How are undo actions handled in text editors? Most editors have unlimited undos, but what happens when the RAM is full? Are temp files created? Can someone explain how this process works?
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Peepsalot



Joined: 06 Oct 2005
Posts: 24

PostPosted: Fri Oct 07, 2005 6:07 pm    Post subject: Reply with quote

Text doesnt take up much RAM so I doubt that filling it up is much of an issue.
But in the event that RAM was full, it would probably be written to virtual memory(on the hard drive). This is handled internally by windows, and you shouldn't really have to worry about it when writing scripts or programs.
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Fri Oct 07, 2005 6:58 pm    Post subject: Reply with quote

There could be many ways implementing unlimited undo's. When I wrote a math text editor many years ago I chose a very simple way: keep a copy of the original file on disk, not changed at file saves, and record all the user input. At an undo request the editor replayed all the user actions from the original file until the requested undo point. It allowed re-do's, too, but when slow operations were executed, like millions of replaces, or rectangular cut over thousands of lines, it was painfully slow. To speed this up, further temporary copies of the files had to be saved after a certain cumulative time the sequence of redo operations would take. (Simple typing is very fast to redo, so thousands of keystrokes are allowed between temporary file creations.) In this way you could start the replay from the last saved file prior to the undo point. Obsolete temp files have to be deleted and a cleanup is needed at the end.

This approach is still slow when you want to go back with single step undo's, so it ought to be complemented with backward action steps, whenever feasible. Simple typing can be undone by backspaces, but undoing large search and replace operations have to load a temporary file.

This way the undo buffer is never too large. Even if you type 100 keystrokes a minute you cannot type more than 150K keys a day.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group