Commit 80cfe136 authored by Albert Gräf's avatar Albert Gräf
Browse files

Refactoring.

parent 0c1b389f
......@@ -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");
}
}
......
......@@ -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, "");
......
Markdown is supported
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