Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF38718826 for ; Wed, 2 Sep 2015 20:58:51 +0000 (UTC) Received: (qmail 36123 invoked by uid 500); 2 Sep 2015 20:58:51 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 36082 invoked by uid 500); 2 Sep 2015 20:58:51 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 35686 invoked by uid 99); 2 Sep 2015 20:58:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Sep 2015 20:58:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C546E7E0C; Wed, 2 Sep 2015 20:58:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: commits@allura.apache.org Date: Wed, 02 Sep 2015 20:59:11 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [22/25] allura git commit: Cleanup paste-indent code Cleanup paste-indent code Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/645fc864 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/645fc864 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/645fc864 Branch: refs/heads/db/7955 Commit: 645fc8643780b3a5aa9f8480e00dce69e02eb12b Parents: 10af293 Author: Dave Brondsema Authored: Wed Sep 2 16:05:46 2015 +0000 Committer: Dave Brondsema Committed: Wed Sep 2 18:27:53 2015 +0000 ---------------------------------------------------------------------- .../lib/widgets/resources/js/sf_markitup.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/645fc864/Allura/allura/lib/widgets/resources/js/sf_markitup.js ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/widgets/resources/js/sf_markitup.js b/Allura/allura/lib/widgets/resources/js/sf_markitup.js index f670437..f91d697 100644 --- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js +++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js @@ -70,15 +70,17 @@ $(window).load(function() { cm = editor.codemirror; + // https://github.com/codemirror/CodeMirror/issues/2120 cm.on("change", function(cm, change) { - - if (change.origin != "paste" || change.text.length < 2) return; - var tabs = 1; - var spaces = tabs * cm.options.tabSize; - cm.operation(function() { - for (var line = change.from.line, end = CodeMirror.changeEnd(change).line; line < end; ++line) - cm.indentLine(line, spaces); - }); + if (change.origin != "paste" || change.text.length < 2) { + return; + } + var spaces = cm.options.tabSize; + cm.operation(function() { + for (var line = change.from.line, end = CodeMirror.changeEnd(change).line; line <= end; ++line) { + cm.indentLine(line, spaces); + } + }); }); function show_help(editor) {