Easier way to do text-movement algorithm?

Monte Goulding monte at sweattechnologies.com
Thu Aug 14 00:52:01 EDT 2003


> > Assuming that your starting point is a list of start and end chars for
> > each
> > section you could simply subtract the number of chars of section A
> > from each
> > section prior to C then add the number of chars of A - the number of
> > chars
> > of C to each section after C.
>
> Why "- the number of chars of C"?

Because he is replacing section C with section A. The char references of
section A become the first char of section C + the number of chars of A.

I actually like your "store each section in an array element" idea better. I
guess if it's a big file it wouldn't be all that quick but it sure would be
easy. If the sections could be numbered then you could just do a combine to
get your text out.

Cheers

Monte




More information about the use-livecode mailing list