script for redo/undo text?

Mark Wieder ahsoftware at sonic.net
Tue Jul 9 18:23:41 EDT 2019


On 7/8/19 8:05 PM, Nicolas Cueto via use-livecode wrote:
> Good day eh.
> 
> To quote a post from "User Experience Stack Exchange
> <https://ux.stackexchange.com/questions/12629/undo-history-why-limit-it>":
> 
> "<bold> undo/redo is one of the biggest implementation, testing and
> maintenance headaches </bold>  in any significantly sized application"
> 
> And yet I ask...
> 
> Would someone care to volunteer a redo/undo script that works on text in a
> text-field object? ... especially a script that provides (almost) full undo
> history?

The Undo section of my refactor plugin is almost completely 
self-contained, so you should be able to extract those handlers (look 
for the "--> Undo handlers" tag near line 2750) and use them with any 
field. Since they're designed to work with the Script Editor, I think 
the only changes you need to make would be to create your own 
scriptFromEditor() function to grab the field text and your own 
CurrentObject() handler to return the long id of the field.

At any rate, this should get you started. And I'm compressing the text 
before storing it in an array, but as Sean points out, this could get 
out of hand.

<https://github.com/mwieder/revRefactor/blob/master/stack_revRefactor_.livecodescript>

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the use-livecode mailing list