do not pair quotes inside strings

This commit is contained in:
nightwing 2014-12-04 14:47:17 +04:00
commit 6b13aedf5f
2 changed files with 11 additions and 0 deletions

View file

@ -120,6 +120,15 @@ module.exports = {
assert.equal(editor.getValue(), "{")
exec("insertstring", 1, "\n");
assert.equal(editor.getValue(), "{\n \n}")
editor.setValue("");
exec("insertstring", 1, "(");
exec("insertstring", 1, '"');
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("")');
exec("backspace", 1);
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("")');
}
};

View file

@ -277,6 +277,8 @@ var CstyleBehaviour = function() {
} else {
if (stringBefore && !stringAfter)
return null; // wrap string with different quote
if (stringBefore && stringAfter)
return null; // do not pair quotes inside strings
var wordRe = session.$mode.tokenRe;
wordRe.lastIndex = 0;
var isWordBefore = wordRe.test(leftChar);