pattr*/textedit: Repeated store/recall adds endless quotes to the string.

Aug 7, 2012 at 3:26pm

pattr*/textedit: Repeated store/recall adds endless quotes to the string.

Hello, Maxers.

I’m trying to persist the contents of a textedit box, but unfortunately I seem to have run into an undesired interaction between textedit and the pattr system.

The store/recall mechanism works just fine as long as the strings I’m storing are fairly simple (i.e. don’t contain spaces) – I can open and close my patch as often as I like, save, etc.

However, if my string contains a space, then each time it reopens the patch, it quotes the string – even if it already quoted it.

So if I put the string wombat into the textedit box, it comes back as wombat every time.

But if I put in the string wombat wombat and close and reopen the patch, it now has “wombat wombat” and then “”wombat wombat”", and next “”"wombat wombat”"” and “”"”wombat wombat”"”".

Unfortunately, I can’t get away without having spaces in my text… though I have a workaround for this (I’m going to load the strings from files and put in the name of the file in the box instead).

(The attentive observer will notice that it’s likely that there’s a second bug revealed by this – because the correct escaping of the string
“”wombat wombat”", is not, in fact “”"wombat wombat”"” but “”\”wombat wombat\”"”)

– Pasted Max Patch, click to expand. –
#63892

You must be logged in to reply to this topic.