From 5261ba5a69c2df7e927c910451360d703bbe70d0 Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Thu, 22 Mar 2012 18:34:08 +0100 Subject: [PATCH] Forward-ported some bugfixes from olad etherpad --- src/static/js/ace2_inner.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 66f19faf1..65a398b56 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -846,7 +846,7 @@ function Ace2Inner(){ var cmdArgs = Array.prototype.slice.call(arguments, 1); if (CMDS[cmd]) { - inCallStack(cmd, function() + inCallStackIfNecessary(cmd, function() { fastIncorp(9); CMDS[cmd].apply(CMDS, cmdArgs); @@ -856,7 +856,7 @@ function Ace2Inner(){ function replaceRange(start, end, text) { - inCallStack('replaceRange', function() + inCallStackIfNecessary('replaceRange', function() { fastIncorp(9); performDocumentReplaceRange(start, end, text); @@ -1159,7 +1159,7 @@ function Ace2Inner(){ return; } - inCallStack("idleWorkTimer", function() + inCallStackIfNecessary("idleWorkTimer", function() { var isTimeUp = newTimeLimit(250); @@ -2335,6 +2335,7 @@ function Ace2Inner(){ var cs = builder.toString(); performDocumentApplyChangeset(cs); } + editorInfo.ace_performDocumentApplyAttributesToRange = performDocumentApplyAttributesToRange; function buildKeepToStartOfRange(builder, start) { @@ -2860,6 +2861,7 @@ function Ace2Inner(){ currentCallStack.selectionAffected = true; } } + editorInfo.ace_performSelectionChange = performSelectionChange; // Change the abstract representation of the document to have a different selection. // Should not rely on the line representation. Should not affect the DOM. @@ -3287,7 +3289,7 @@ function Ace2Inner(){ function handleClick(evt) { - inCallStack("handleClick", function() + inCallStackIfNecessary("handleClick", function() { idleWorkTimer.atMost(200); }); @@ -3609,7 +3611,7 @@ function Ace2Inner(){ var stopped = false; - inCallStack("handleKeyEvent", function() + inCallStackIfNecessary("handleKeyEvent", function() { if (type == "keypress" || (isTypeForSpecialKey && keyCode == 13 /*return*/ )) @@ -4698,7 +4700,7 @@ function Ace2Inner(){ } // click below the body - inCallStack("handleOuterClick", function() + inCallStackIfNecessary("handleOuterClick", function() { // put caret at bottom of doc fastIncorp(11); @@ -4771,7 +4773,7 @@ function Ace2Inner(){ function setup() { doc = document; // defined as a var in scope outside - inCallStack("setup", function() + inCallStackIfNecessary("setup", function() { var body = doc.getElementById("innerdocbody"); root = body; // defined as a var in scope outside