diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js index 76e12fc3..8397e79c 100644 --- a/lib/ace/mode/behaviour/cstyle.js +++ b/lib/ace/mode/behaviour/cstyle.js @@ -88,8 +88,6 @@ var CstyleBehaviour = function () { this.add("braces", "insertion", function (state, action, editor, session, text) { if (text == '{') { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && selected !== "{") { @@ -97,7 +95,7 @@ var CstyleBehaviour = function () { text: '{' + selected + '}', selection: false }; - } else { + } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, "}"); return { text: '{}', @@ -152,8 +150,6 @@ var CstyleBehaviour = function () { this.add("parens", "insertion", function (state, action, editor, session, text) { if (text == '(') { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "") { @@ -161,7 +157,7 @@ var CstyleBehaviour = function () { text: '(' + selected + ')', selection: false }; - } else { + } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, ")"); return { text: '()', @@ -199,8 +195,6 @@ var CstyleBehaviour = function () { this.add("brackets", "insertion", function (state, action, editor, session, text) { if (text == '[') { - if (!CstyleBehaviour.isSaneInsertion(editor, session)) - return; var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "") { @@ -208,7 +202,7 @@ var CstyleBehaviour = function () { text: '[' + selected + ']', selection: false }; - } else { + } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, "]"); return { text: '[]',