summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-09-18 14:18:43 +0200
committerRobert Zorko <robertz@gurucue.com>2015-09-18 14:18:43 +0200
commitc3898354b2e78ba30b363ecfa5dc4829d1279a7f (patch)
tree2c6d98732a70a1303555b24ea276da9c5e2cf5a6 /js
parent2a797e8b59a8491d9b73b119de1092ca8b65555f (diff)
parent99edd51f53b03a49e8c61f95eef0cd6f94e87c2b (diff)
Merge branch 'master' into stateMachine
Diffstat (limited to 'js')
-rw-r--r--js/codeq/hint.js13
-rw-r--r--js/prolog.js2
-rw-r--r--js/python.js2
3 files changed, 10 insertions, 7 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index a94f571..06eceb0 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -35,14 +35,17 @@
if (!args)
return template;
return template.replace(/\[%=(\w+)%\]/g, function(match, name) {
- return args[name];
+ return args[name].toString()
+ .replace(/&/g, '&amp')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;');
});
},
typeHandlers = {
'static': function (type, template, serverHint) {
var args = serverHint.args,
- jqContainer, jqButton, i, lastIndex;
+ jqContainer, jqButton, i, N;
if (template instanceof Array) { // unwrap the template if there's only one
if (template.length == 0) template = '';
else if (template.length == 1) template = template[0] + ''; // it must be a string
@@ -52,14 +55,14 @@
jqContainer = $('<div class="hint-static-group"></div>');
jqButton = $('<button type="button">More...</button>'); // TODO: translate "more"
jqHints.append(jqContainer);
- lastIndex = template.length - 1;
+ N = template.length;
jqContainer.append('<div class="hint-static">' + processTemplate(template[0], args) + '</div>');
jqContainer.append(jqButton);
i = 1;
jqButton.on('click', function () {
var jqNext = $('<div class="hint-static">' + processTemplate(template[i], args) + '</div>');
i++;
- if (i < lastIndex) {
+ if (i < N) {
jqButton.before(jqNext);
}
else {
@@ -181,4 +184,4 @@
}
};
};
-})(); \ No newline at end of file
+})();
diff --git a/js/prolog.js b/js/prolog.js
index ecec0f3..29ceb3d 100644
--- a/js/prolog.js
+++ b/js/prolog.js
@@ -157,7 +157,7 @@
pos = codeq.codePointCount(doc.getRange(firstCharacterPos, changeObj.from));
if (changeObj.removed) {
- activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'len': codeq.codePointCount(changeObj.removed)});
+ activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'len': codeq.codePointCount(changeObj.removed.join(''))});
}
if (changeObj.text) {
diff --git a/js/python.js b/js/python.js
index d114b7e..fa4943b 100644
--- a/js/python.js
+++ b/js/python.js
@@ -109,7 +109,7 @@
pos = codeq.codePointCount(doc.getRange(firstCharacterPos, changeObj.from));
if (changeObj.removed) {
- activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'len': codeq.codePointCount(changeObj.removed)});
+ activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'len': codeq.codePointCount(changeObj.removed.join(''))});
}
if (changeObj.text) {