Translate metadata to field content

Mark Waddingham mark at
Tue Feb 18 14:41:48 EST 2020

On 2020-02-18 19:14, J. Landman Gay via use-livecode wrote:
> Thanks for the reply guys, both Hermann and Mark, and Bernd who sent
> me materials offline. I'll be going over these suggestions to see what
> works best. The file content can be very long especially when
> separated into runs (more than 200,000 runs for an average file) so
> speed will matter since this is headed for a mobile app.
> I was surprised to see two things:
> 1. FormattedStyledText appears nowhere in the dictionary. I didn't
> know it existed.

Heh - I'd actually forgotten about it until a couple of weeks ago when I 
had to write some code to independently process the each soft-wrapped 
line of styled text in a field.

I half wrote some code to do what I wanted in a different way while 
wishing 'if only I had implemented the formatted variant for styledText 
wayback when' - then I happily remembered that I had!

If you have a moment to file an report in the QC, we can get it added.

> 2. FormattedStyledText treats some punctuation as a new run, even if
> it has not changed text style. For example, semi-colons are
> independent runs. Very odd.

Hmmm - there's no code to do that explicitly (a semi-colon is no 
different from any other char!). Non-merged style runs can occur through 
some script operations on a field though (the engine uses 0 length runs 
sometimes as markers - they would probably cause that effect). It could 
also be due to the structure of the htmlText being imported 
(potentially). If you have a simple example, then I can probably say one 
way or the other.

The formattedStyledText, like the styledText, is just a array version of 
the data-structure the engine holds inside (although it never emits 0 
length runs).

In this case that shouldn't matter though as it will be the text that 
you want to count, not the runs.

Warmest Regards,


Mark Waddingham ~ mark at ~
LiveCode: Everyone can create apps

More information about the use-livecode mailing list