From b126f5d314945d57c402e34cf40c39262126ed1a Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Thu, 18 Oct 2012 15:32:31 +0200 Subject: [PATCH] Allow multiple bracket closing insertionss like {{{}}} --- lib/ace/mode/behaviour/cstyle.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js index 0efac142..259180f3 100644 --- a/lib/ace/mode/behaviour/cstyle.js +++ b/lib/ace/mode/behaviour/cstyle.js @@ -45,15 +45,14 @@ var CstyleBehaviour = function () { if (!this.$matchTokenType(iterator.getCurrentToken() || "text", ["text"])) { // Look ahead in case we're at the end of a token 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; } - // Don't insert in front of identifiers or brackets + // Only insert in front of whitespace/comments iterator.stepForward(); - if (this.$matchTokenType(iterator.getCurrentToken() || "text", ["identifier", "paren.lparen"])) - return false; - return true; + return iterator.getCurrentTokenRow() !== cursor.row || + this.$matchTokenType(iterator.getCurrentToken() || "text", ["text", "comment", "paren.rparen"]); }; CstyleBehaviour.$matchTokenType = function(token, types) {