the mouseText and Unicode: a 3-char puzzle
Slava Paperno
slava at lexiconbridge.com
Wed Jun 22 00:38:33 EDT 2011
I like your definition... "a poor man's Unicode." Cute.
Thanks for everything,
Slava
> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] On Behalf Of BNig
> Sent: Tuesday, June 21, 2011 5:39 PM
> To: use-revolution at lists.runrev.com
> Subject: Re: the mouseText and Unicode: a 3-char puzzle
>
> Slava,
>
> it worked on a self assembled russian text including em-dash and
> guillemets
> but not on your text.
>
> This works on your text:
>
> ------------------------------------------
> on mouseUp
> lock screen
> get word 4 of the clickCharChunk
> put it into tSelPos
> put 0 into tStartSel
>
> repeat with i = tSelPos down to 1
> put the htmlText of char i of field "textToClickB" into tHTML
> if (tHTML contains "<p> <" or tHTML is "<p></p>" or tHTML
> contains
> ">,<" or tHTML contains ">.<" \
> or tHTML contains "> </font" or tHTML contains
> ">&•••nbsp;<" or tHTML contains ">&•••laquo;<" or tHTML
> contains
> ">&•••raquo;<") then
> put i into tStartSel
> exit repeat
> end if
> end repeat
>
> put the number of chars of field 1 into tEndSel
> repeat with i = tSelPos to the number of chars of field 1
> put the htmlText of char i of field "textToClickB" into tHTML
> put char i of tData into taChar
> if (tHTML contains "<p> <" or tHTML is "<p></p>" or tHTML
> contains
> ">,<" or tHTML contains ">.<" \
> or tHTML contains "> </font" or tHTML contains
> ">&•••nbsp;<" or tHTML contains ">&•••laquo;<" or tHTML
> contains
> ">&•••raquo;<") then
> put i into tEndSel
> exit repeat
> end if
> end repeat
>
> select char tStartSel + 1 to tEndSel -1 of me
>
> put the htmlText of the selectedtext into tWordClicked
> set the htmlText of field "ClickedWord" to tWordClicked
> unlock screen
> end mouseUp
> -------------------------------------------
>
> I added 3 bullets ••• to prevent the automatic conversion to the html
> characters, I am posting via Nabble. You'd have to remove the ••• and
> please
> watch out for linebreaks.
>
>
> I am shure there are more gotchas and it is not getting nicer this way
> but
> it is a poor man's unicode :)
>
> Kind regards
>
> Bernd
More information about the use-livecode
mailing list