Changing the Style of Words in Field And Quotation Marks?
Peter Brigham MD
pmbrig at gmail.com
Mon May 3 16:18:20 EDT 2010
I tried your approach and got bogged down, and finally cut the Gordian
knot by avoiding the problem altogether. What I ended up doing was
making sure that there are no true quotation marks in the text field
-- use "smart quotes" instead. Open quote = numtochar(210) and close
quote = numtochar(211). In my stack I use a rawkeydown handler to
ensure that user-typed quotes are replaced with the appropriate smart
quote. If the preceding character is in cr & space & tab or the char
is the first char of the field then replace with numtochar(210) else
replace with numtochar(211). (For imported text, process the text
using the same rules before putting it into the field.) Then the word
counts work properly and all you have to do is make sure that any
colorization/formatting excludes an initial or trailing smart quote
(looks better that way).
The general problem here is that, contrary to all other computing
contexts I know about, in Rev anything enclosed by true quotation
marks is regarded by the engine as one word. This causes no end of
problems for text manipulation (which I do a lot of). PITA.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On May 3, 2010, at 3:22 PM, John Patten wrote:
> Hi All...
>
> I'm working on a little student utility that changes the text color
> and underlines the individual word in the target field as they hit
> the space bar. I'm wondering how I should handle passages of text
> that are surrounded by quotation marks?
>
> I was taking the text passage and stripping out the quotes to get
> the total number of words in the field. Then using that number and
> reducing it to target the specific words in the field to modify
> their text style.
>
> The quotation marks create a single word out of the phrase, and if I
> attempt to delete a quote and then add it back the total number of
> words in my variable is off. In any case, everything gets all wonky
> when there are quotes in the passage...
>
>
> Anyone done something similar?
>
>
> Thank you!
>
> John Patten
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list