Undos [was: Script Editor]
Jan Schenkel
janschenkel at yahoo.com
Wed May 21 16:24:08 EDT 2008
--- Richmond Mathewson <geradamas at yahoo.com> wrote:
> I wonder how one would implement unlimited undos in
> Runtime Revolution?
>
> Presumably everytime therewas a keyDown inside the
> scriptEditor a new field would have to be created to
> hold it - and very quickly the whole thing would
> grind
> to a halt ? ? ?
>
> Or, very keyDown would write to a new text file
> which
> could then be reloaded into the scriptEditor field ?
> ?
> ?
>
> I hope somebody out there knows more than I do about
> this !
>
> sincerely, Richmond Mathewson
>
You could use 'snapshots' of the text and save those
in custom properties or even an array variable.
There's no need to capture every single keystroke as
the time for a new snapshot - use some 'strategic'
characters as triggers: space, backspace, return - or
employ a sort of timed interval scheme where you store
it if the user hasn't done anything for a second.
I wouldn't like to have to press Command-Z twenty
times to get rid of the last long word that I typed,
one character at a time. Word processor behaviour is
probably the best approach to mimic, as it would feel
natural to users.
Given that you have 'the selectedChunk' as a property,
you could limit what you store to the line(s) involved
in the change, cutting down memory consumption even
more.
Jan Schenkel.
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
More information about the use-livecode
mailing list