Check for sane quote insertion at the latest possible point

This commit is contained in:
Lennart Kats 2012-10-24 15:23:24 +02:00 committed by nightwing
commit 67fe548347

View file

@ -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]