Page 1 of 1

nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 5:47 pm
by pderks
Hi,

Code: Select all

put ""
put "AA" & NumToCodepoint(160) & "BB" into XX
put "1" & tab & XX & tab & "Segments" & tab & the Num of segments of XX & cr after msg
put "1" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after msg
put "1" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after msg
put "AA" & NumToChar(202) & "BB" into XX -- nbsp MacRoman
put "2" & tab & XX & tab & "Segments" & tab & the Num of segments of XX & cr after msg
put "2" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after msg
put "2" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after msg
If I type "AA" and an option-space and "BB" I get again 2 words instead of only one.

Is that an achievement of of LC 9.0.4 ?

Peter

Mac Pro 2012 · macOS 10.12.6 · LC 9.0.4 CE

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 6:20 pm
by Klaus
Hi Peter,

no idea if this is new in 9.0.4, but it works as expected, the AA BB will WRAP as if it is ONE word.

However LC does treat them as two words.
This is the definition of a word in LC, anything separated by a SPACE, comma etc. and LC does obviously treat a non-breaking space as a space resp. does not differ them

Not sure if this is a bug or a feature!?


Best

Klaus

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 6:35 pm
by pderks
Hi, Klaus,

it is a bug in LC 9.0.4.

I just typed into the msg box of LC 5.0.5 Build 1503:

Code: Select all

put "AA BB" into XX; put num of words in XX
and got "1".

Bester

Peter

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 7:01 pm
by dunbarx
I am usually behind the times with all these new-fangled chunk options in the most recent versions, but anything enclosed in quotes was always one word.

The "trueWord" keyword seems to be the ticket here. It uses the ICU library, not LiveCodes own peccadilloes, as the delimiter between those two strings.

Craig

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 7:08 pm
by Klaus
Hi Craig,

true, but the content of the variable XX does NOT contain the QUOTES!

Just tested in 5.02 with this script, had to comment out lines with NumToCodepoint and SEGMENT:

Code: Select all

on mouseUp
   put "" into fld 1
   put "AA BB" into XX
   put "1" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after fld 1
   put "1" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after fld 1
   put "AA" & NumToChar(202) & "BB" into XX -- nbsp MacRoman
   put "2" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after fld 1
   put "2" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after fld 1
end mouseUp
And got:
1 AA BB Words 1
1 AA BB Chars 5
2 AA BB Words 1
2 AA BB Chars 5

So this is definitively a bug.

@Peter
Did you already report this?


Best

Klaus

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 7:37 pm
by pderks
Klaus, I did …

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 7:41 pm
by dunbarx
true, but the content of the variable XX does NOT contain the QUOTES!
True. I was thinking theoretically, not, you know, in any useful way.

Craig

Re: nbsp (non-breaking space) breaks

Posted: Mon Jun 10, 2019 7:47 pm
by Klaus
pderks wrote:
Mon Jun 10, 2019 7:37 pm
Klaus, I did …
Thank you!

For your interest: https://quality.livecode.com/show_bug.cgi?id=22165

Re: nbsp (non-breaking space) breaks

Posted: Tue Jun 11, 2019 1:51 pm
by sphere
Seems to work correct in LC950dp1
putinXX.zip
(637 Bytes) Downloaded 254 times
the lower button does what you describe

edit: and this
put "AA BB" into XX; put num of words in XX
gives 2 in the messagebox

or am i misunderstanding you?