Commit 4511ba85 authored by user's avatar user
Browse files

oops... use binbuf_restore instead of binbuf_add to get dollargs to do the...

oops... use binbuf_restore instead of binbuf_add to get dollargs to do the "right thing". Also fixed a debugging comment to keep it from printing garbage
parent bfb265d6
......@@ -41,6 +41,15 @@ function add_keymods(key, evt) {
return shift + ctrl + key;
}
function text_to_fudi(text) {
text = text.trim();
text = text.replace(/(\$[0-9]+)/g, '\\$1'); // escape dollar signs
text = text.replace(/(?!\\)(,|;)/g, ' \\$1 '); // escape ',' and ';'
text = text.replace(/\{|\}/g, ''); // filter '{' and '}'
text = text.replace(/\s+/g, ' '); // filter consecutive /s
return text;
}
var canvas_events = (function() {
var name,
textbox = function () {
......@@ -141,9 +150,9 @@ var canvas_events = (function() {
},
text_mousedown: function(evt) {
if (textbox() !== evt.target) {
pdgui.gui_post("my content was " + textbox().textContent);
pdgui.pdsend(name + " stringforobj "
+ textbox().textContent);
var fudi_msg = text_to_fudi(textbox().textContent);
pdgui.pdsend(name + " stringforobj " + fudi_msg);
pdgui.gui_post("formatted content is " + fudi_msg);
events.mousedown(evt);
canvas_events.normal();
}
......
......@@ -7624,9 +7624,8 @@ static void canvas_stringforobj(t_canvas *x, t_symbol *s, int argc, t_atom *argv
{
if (glist_isselected(x, y) && (rtext = glist_findrtext(x, (t_text *)y)))
{
rtext_gettext(rtext, &buf, &length);
t_binbuf *b = binbuf_new();
binbuf_add(b, argc, argv);
binbuf_restore(b, argc, argv);
binbuf_gettext(b, &buf, &length);
rtext_settext(rtext, buf, length);
binbuf_free(b);
......
......@@ -82,7 +82,7 @@ void binbuf_clear(t_binbuf *x)
/* convert text to a binbuf */
void binbuf_text(t_binbuf *x, char *text, size_t size)
{
//fprintf(stderr, "current text: %s\n", text);
//fprintf(stderr, "current text: %.*s\n", size, text);
char buf[MAXPDSTRING+1], *bufp, *ebuf = buf+MAXPDSTRING;
const char *textp = text, *etext = text+size;
t_atom *ap;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment