nbsp (non-breaking space) breaks

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
pderks
Posts: 56
Joined: Sat May 14, 2011 4:25 pm
Location: Krefeld • Deutschland

nbsp (non-breaking space) breaks

Post by pderks » Mon Jun 10, 2019 5:47 pm

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

Klaus
Posts: 11112
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nbsp (non-breaking space) breaks

Post by Klaus » Mon Jun 10, 2019 6:20 pm

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

pderks
Posts: 56
Joined: Sat May 14, 2011 4:25 pm
Location: Krefeld • Deutschland

Re: nbsp (non-breaking space) breaks

Post by pderks » Mon Jun 10, 2019 6:35 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6117
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: nbsp (non-breaking space) breaks

Post by dunbarx » Mon Jun 10, 2019 7:01 pm

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

Klaus
Posts: 11112
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nbsp (non-breaking space) breaks

Post by Klaus » Mon Jun 10, 2019 7:08 pm

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

pderks
Posts: 56
Joined: Sat May 14, 2011 4:25 pm
Location: Krefeld • Deutschland

Re: nbsp (non-breaking space) breaks

Post by pderks » Mon Jun 10, 2019 7:37 pm

Klaus, I did …

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6117
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: nbsp (non-breaking space) breaks

Post by dunbarx » Mon Jun 10, 2019 7:41 pm

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

Klaus
Posts: 11112
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nbsp (non-breaking space) breaks

Post by Klaus » Mon Jun 10, 2019 7:47 pm

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

sphere
Posts: 900
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: nbsp (non-breaking space) breaks

Post by sphere » Tue Jun 11, 2019 1:51 pm

Seems to work correct in LC950dp1
putinXX.zip
(637 Bytes) Downloaded 19 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?
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”