Mark Waddingham wrote:

> Whenever a range of text is set in a field, the selection is set to
> the beginning of the chunk that was set - so in the case of 'replace'
> acting on the whole field, that would be the beginning.
>
> Using the '(replacing | preserving) styles' form works slightly
> differently - it iterates through the content of the field, and only
> mutates the parts which are to be replaced. So with that form, the
> selection index would end up being the beginning of the last
> occurrence of x which was replaced with y.
>
> The rule is relatively sensible I think - since if a range of text is
> replaced, the only index you can guarantee will be in the same place
> as  it was before is the beginning of the range which was replaced...

Yes, quite sensible with that description.  Thanks.

> The textChanged message is a bit of a blunt instrument -  mainly
> because it was the best we could add to the field at the time
> without potentially ending up down a whole set of rabbit warrens, or
> impacting performance too much.

As I was writing my post I pondered what a proposed change might be, and I couldn't think of a good one. Yes, it is a blunt instrument, but with that it's also predictable, and consistent with other text messages.

Maybe there's a better way, but frankly where I've used it in real-world projects I've found the textChanged message very useful as-is.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to