From 67fe54834722c68c70f73a74c3cfa7302b53f750 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Wed, 24 Oct 2012 15:23:24 +0200 Subject: [PATCH] Check for sane quote insertion at the latest possible point --- lib/ace/mode/behaviour/cstyle.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js index ab6fed23..3781afe8 100644 --- a/lib/ace/mode/behaviour/cstyle.js +++ b/lib/ace/mode/behaviour/cstyle.js @@ -249,7 +249,7 @@ var CstyleBehaviour = function () { text: quote + selected + quote, selection: false }; - } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { + } else { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var leftChar = line.substring(cursor.column-1, cursor.column); @@ -279,6 +279,8 @@ var CstyleBehaviour = function () { // Try and be smart about when we auto insert. if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) { + if (!CstyleBehaviour.isSaneInsertion(editor, session)) + return; return { text: quote + quote, selection: [1,1]