Allow multiple bracket closing insertionss like {{{}}}

This commit is contained in:
Lennart Kats 2012-10-18 15:32:31 +02:00
commit b126f5d314

View file

@ -45,15 +45,14 @@ var CstyleBehaviour = function () {
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", ["text"])) { if (!this.$matchTokenType(iterator.getCurrentToken() || "text", ["text"])) {
// Look ahead in case we're at the end of a token // Look ahead in case we're at the end of a token
iterator = new TokenIterator(session, cursor.row, cursor.column + 1); iterator = new TokenIterator(session, cursor.row, cursor.column + 1);
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", ["text"])) if (!this.$matchTokenType(iterator.getCurrentToken() || "text", ["text", "paren.rparen"]))
return false; return false;
} }
// Don't insert in front of identifiers or brackets // Only insert in front of whitespace/comments
iterator.stepForward(); iterator.stepForward();
if (this.$matchTokenType(iterator.getCurrentToken() || "text", ["identifier", "paren.lparen"])) return iterator.getCurrentTokenRow() !== cursor.row ||
return false; this.$matchTokenType(iterator.getCurrentToken() || "text", ["text", "comment", "paren.rparen"]);
return true;
}; };
CstyleBehaviour.$matchTokenType = function(token, types) { CstyleBehaviour.$matchTokenType = function(token, types) {