[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Programming challenge: Undo



** Reply to message from Bill Troop  on
Tue, 01 Jul 2008 21:19:18 +0100


> And the one potential problem with a timed backup:
> if you are writing slowly, a significant event may be lost.

No. At any given moment, if XyWrite makes a backup, it
faithfully records the state of the document at that moment.
Suppose you make another backup 10 seconds later, and then
another, 10 seconds later. Those too are faithful records of
the moment. What can be lost? Nothing. My prototype program
is careful, on the first Undo, to make sure that it makes a
backup of the current document, so you can always revert to that
if necessary.

> a complex chain of events - - something like
> 'select sentence, replace with the letter K,
> then move cursor up' -- all over with in a millisecond.

And then you catch your breath for 5 seconds. Look, suppose the
Undo program checks every 10 seconds whether anything has
changed in your current document -- if something has changed, it
makes a backup; if nothing has changed, it waits another 10
seconds and checks again. How many amazing millisecond events
are going to occur within 10 seconds? One? Two? None? The
worst that can happen is that you have to redo a few keystrokes
manually, in order to get rid of some fatal mistake. Big deal.

> Re the keystroke problem, couldn't you record
> let us say 100 keystrokes, then force a backup, and start over?

No you can't. Why? Because what you call a "keystroke" can be
many many actions, all loaded onto one key in the KBD file. We
don't just type alphanumeric characters -- if we did, then yes
your concept would be feasible. But that's not the reality in
Xy4. Many of those actions "expect" a particular type of input
or character as the next thing they see. If, instead, they see
a call to memorize the keystroke, they'll be fried -- can easily
hang the session completely. It won't work, except under very
controlled circumstances, for a short burst, where you basically
know in advance what alternatives the user has and can plan for
all the possible outcomes.

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------