the mouseText and Unicode: a 3-char puzzle

BNig niggemann at uni-wh.de
Tue Jun 21 17:38:41 EDT 2011


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


--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/the-mouseText-and-Unicode-a-3-char-puzzle-tp3613315p3615417.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list