espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.77k stars 746 forks source link

g.wrapString sometimes removing last character #2572

Open retcurve opened 2 weeks ago

retcurve commented 2 weeks ago

g.wrapString is removing the last character if the character before it is one of the canSplitAfter characters, eg . - or , This happens no matter how wide the wrap width is. For example -

g.wrapString('test.a', 100) returns test. and not test.a

Multiple characters after the split character work fine (g.wrapString('test.aa', 100) returns test.aa) as do spaces (g.wrapString('test a', 100) returns test a)

bobrippling commented 2 weeks ago

I can't see any recent changes to wrapString, @gfwilliams possibly a pre-existing bug?

gfwilliams commented 2 weeks ago

Thanks for the report - yes, I doubt this is something that new - it probably came in when the word-splitting got added.