Setting hidden of lines very slow

hh hh at hyperhh.de
Mon Dec 3 12:05:21 EST 2018


Sorry, the styledText method of my last post had a logic fault
(style-runs without textcolor are ignored).

The following works now for me.

-- styledText method
on mouseUp
  put the millisecs into m1
  lock screen; lock messages
  put the styledText of field "text" into tTextA
  repeat for each key aKey in tTextA
    put tTextA[aKey]["runs"] into T
    put true into isEmpty
    repeat for each key I in T
      put isEmpty and (T[I]["style"]["textcolor"] is empty) into isEmpty
    end repeat
    put isEmpty into tTextA[aKey]["style"]["hidden"]
  end repeat
  set the styledText of fld "text" to tTextA
  put the millisecs - m1 into fld "timing"
end mouseUp

-- htmlText method
on mouseUp
  put the millisecs into m1
  lock screen; lock messages
  put ("color=" is in fld 1) into isInField
  if isInField then
    replace "color=" with numTochar(1) in fld 1 preserving styles
  end if
  set linedel to "<p"
  put the htmltext of fld 1 into ht
  replace " hidden" with empty in ht
  repeat for each line L in ht
    if offset("color=",L)>0 then
      put "<p" & L after s
    else put "<p hidden" & L after s
  end repeat
  set htmltext of fld 1 to  s
  if isInField then
    replace numTochar(1) with "color=" in fld 1 preserving styles 
  end if
  put the millisecs - m1 into fld "timing"
end mouseUp





More information about the use-livecode mailing list