[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: Programming challenge: Undo
- Subject: Re: Programming challenge: Undo
- From: "Robert Holmgren" holmgren@xxxxxxxx
- Date: Thu, 26 Jun 2008 22:11:06 -0400
** Reply to message from Harry Binswanger on
Sat, 21 Jun 2008 13:46:35 -0400
> So SBS is not a "mode" but a function, used like AS?
"Mode"? How does SBS resemble a MoDe? I guess you could say it
is similar to a function, or to a command. But hey, it's a
program!
This whole question of designing an UNDO command requires a
great deal of clear definition, before anyone could begin to
craft a solution. What actions need to be UnDone? What
constitutes an action? A single keystroke? A formatting
command? Use of a frame in U2? Use of a native command (like
GoText func GT)? What???? All of the above? And Undo to how
many levels? Would each user select the actions that merit an
Undo, by inserting a function in their KBD file (similar to the
way STack works)?
What's the TOTAL CONCEPT? Don't say "like Microsoft Word's
UnDo" -- you need to spell it out. Bill Troop said as much
already.
The only foolproof way to UnDo in XyWrite is to create multiple
levels of "snapshots" -- backup files -- similar to Carl's
SAVEBAK, perhaps capping the number of backups at a
user-determined number like 10 or 20 (instead of SAVEBAK's 999,
although I guess if the user wanted a zillion backups, they
could have them) -- if, for example, the UnDo spec called for
ten levels of UnDo, Undo #11 would recycle the oldest Undo, #1,
as #11 -- so at any given time you'd be able to UnDo the ten
most recent actions. With higher numbers than 10, or unlimited
numbers, you'd need plenty of disk space, lest this get out of
control.
The problem with making backup files is that they slow you down.
How much depends on your machine and the size of the file you're
working on.
The alternative, far more sophisticated, is to try to capture
keystrokes and either keep them in memory, or log them to disk.
Capturing keystrokes can be done, but it's messy and doesn't
always work. Reversing an action -- reversing the LOGIC of it!
-- is even messier, and finally not even remotely possible. How
would you reverse a SORT command, for example? Fuhgeddaboutit.
Anyway, you certainly bust XPL's memory bank with the "capture
keystroke" approach. (The only way to reverse a SORT command is
to take a snapshot of it before you sort.)
Thoughts, anyone?
-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------