From f6b5cd1dab40fc30389f0bd3bc3792c3ebb65e33 Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Fri, 16 Dec 2016 22:52:48 +0100
Subject: [PATCH] Experimental: enable curly braces as ordinary characters.

This change allows curly braces {} to be accepted as keypress events and entered into object and message boxes. It doesn't change the quoting rules for these characters, so [print] still escapes them with backslashes.
---
 pd/nw/dialog_gatom.html  | 2 +-
 pd/nw/dialog_iemgui.html | 2 +-
 pd/nw/pd_canvas.js       | 2 +-
 pd/src/g_editor.c        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html
index 85d1e7732..a6a298dd9 100644
--- a/pd/nw/dialog_gatom.html
+++ b/pd/nw/dialog_gatom.html
@@ -168,7 +168,7 @@ function substitute_space(arg) {
 }
 
 function strip_problem_chars(arg) {
-    var problem_chars = [";", ",", "{", "}", "\\"];
+    var problem_chars = [";", ","/*, "{", "}"*/, "\\"];
     var ret = arg;
     for(var i = 0; i < problem_chars.length; i++) {
         ret = ret.split(problem_chars[i]).join("");
diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html
index 84e1cae08..d67ddf471 100644
--- a/pd/nw/dialog_iemgui.html
+++ b/pd/nw/dialog_iemgui.html
@@ -346,7 +346,7 @@ function substitute_space(arg) {
 }
 
 function strip_problem_chars(arg) {
-    var problem_chars = [";", ",", "{", "}", "\\"],
+    var problem_chars = [";", ","/*, "{", "}"*/, "\\"],
         ret = arg,
         i;
     for(i = 0; i < problem_chars.length; i++) {
diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index 8b9ef2207..8237b099a 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -49,7 +49,7 @@ function text_to_fudi(text) {
     text = text.replace(/(\$[0-9]+)/g, "\\$1");    // escape dollar signs
     text = text.replace(/(\$@)/g, "\\$@");         // escape special $@ sign
     text = text.replace(/(?!\\)(,|;)/g, " \\$1 "); // escape "," and ";"
-    text = text.replace(/\{|\}/g, "");             // filter "{" and "}"
+    //text = text.replace(/\{|\}/g, "");             // filter "{" and "}"
     text = text.replace(/\u0020+/g, " ");          // filter consecutive ascii32
     return text;
 }
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 9a92edb63..4c4e56503 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -4946,7 +4946,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
     else gotkeysym = gensym("?");
     //fflag = (av[0].a_type == A_FLOAT ? av[0].a_w.w_float : 0);
     keynum = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float : 0);
-    if (keynum == '\\' || keynum == '{' || keynum == '}')
+    if (keynum == '\\' /*|| keynum == '{' || keynum == '}'*/)
     {
         post("keycode %d: dropped", (int)keynum);
         return;
-- 
GitLab