From dad1ac4e61e17cc80235ce60f4698f20ae04b3ab Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 4 Oct 2011 21:56:45 +0500 Subject: [PATCH] allow behaviours to cancel delete --- lib/ace/mode/behaviour/cstyle.js | 10 ++-------- lib/ace/mode/behaviour/xml.js | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js index bfa14273..81016b9e 100644 --- a/lib/ace/mode/behaviour/cstyle.js +++ b/lib/ace/mode/behaviour/cstyle.js @@ -78,7 +78,7 @@ var CstyleBehaviour = function () { if (rightChar == '}') { var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1}); if (!openBracePos) - return false; + return null; var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString()); var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row)); @@ -89,7 +89,6 @@ var CstyleBehaviour = function () { } } } - return false; }); this.add("braces", "deletion", function (state, action, editor, session, range) { @@ -102,7 +101,6 @@ var CstyleBehaviour = function () { return range; } } - return false; }); this.add("parens", "insertion", function (state, action, editor, session, text) { @@ -134,7 +132,6 @@ var CstyleBehaviour = function () { } } } - return false; }); this.add("parens", "deletion", function (state, action, editor, session, range) { @@ -147,7 +144,6 @@ var CstyleBehaviour = function () { return range; } } - return false; }); this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { @@ -166,7 +162,7 @@ var CstyleBehaviour = function () { // We're escaped. if (leftChar == '\\') { - return false; + return null; } // Find what token we're inside. @@ -205,7 +201,6 @@ var CstyleBehaviour = function () { } } } - return false; }); this.add("string_dquotes", "deletion", function (state, action, editor, session, range) { @@ -218,7 +213,6 @@ var CstyleBehaviour = function () { return range; } } - return false; }); } diff --git a/lib/ace/mode/behaviour/xml.js b/lib/ace/mode/behaviour/xml.js index 182b350e..f5d8c6e0 100644 --- a/lib/ace/mode/behaviour/xml.js +++ b/lib/ace/mode/behaviour/xml.js @@ -82,7 +82,6 @@ var XmlBehaviour = function () { } } } - return false; }); }