Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Rishabh Gupta
purr-data
Commits
80cfe136
Commit
80cfe136
authored
Jan 14, 2017
by
Albert Gräf
Browse files
Refactoring.
parent
0c1b389f
Changes
2
Hide whitespace changes
Inline
Side-by-side
pd/nw/pd_canvas.js
View file @
80cfe136
...
...
@@ -92,17 +92,6 @@ function string_to_array_of_chunks(msg) {
return
out_array
;
}
// Should probably be in pdgui.js
function
encode_for_dialog
(
s
)
{
s
=
s
.
replace
(
/
\+
/g
,
"
++
"
);
s
=
s
.
replace
(
/
\s
/g
,
"
+_
"
);
s
=
s
.
replace
(
/
\$
/g
,
"
+d
"
);
s
=
s
.
replace
(
/;/g
,
"
+s
"
);
s
=
s
.
replace
(
/,/g
,
"
+c
"
);
s
=
"
+
"
+
s
;
return
s
;
}
// Super-simplistic guess at whether the string from the clipboard
// starts with Pd code. This is just meant as a convenience so that
// stuff in the copy buffer that obviously isn't Pd code doesn't get
...
...
@@ -371,7 +360,7 @@ var canvas_events = (function() {
pdgui
.
pdsend
(
name
,
"
findagain
"
);
}
else
{
pdgui
.
pdsend
(
name
,
"
find
"
,
encode_for_dialog
(
t
),
pdgui
.
encode_for_dialog
(
t
),
match_words_state
?
"
1
"
:
"
0
"
);
}
}
...
...
pd/nw/pdgui.js
View file @
80cfe136
...
...
@@ -459,6 +459,21 @@ var font_fixed_metrics = [
// Utility Functions
// This is used to escape spaces and other special delimiters in FUDI
// arguments for dialogs. (The reverse function is sys_decodedialog() in the C
// code.)
function
encode_for_dialog
(
s
)
{
s
=
s
.
replace
(
/
\+
/g
,
"
++
"
);
s
=
s
.
replace
(
/
\s
/g
,
"
+_
"
);
s
=
s
.
replace
(
/
\$
/g
,
"
+d
"
);
s
=
s
.
replace
(
/;/g
,
"
+s
"
);
s
=
s
.
replace
(
/,/g
,
"
+c
"
);
s
=
"
+
"
+
s
;
return
s
;
}
exports
.
encode_for_dialog
=
encode_for_dialog
;
// originally used to enquote a string to send it to a tcl function
function
enquote
(
x
)
{
var
foo
=
x
.
replace
(
/,/g
,
""
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment