From cc7c023e7addb81a267838d2c77ce4e3dd31d65a Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 18 Mar 2013 11:06:42 +0400 Subject: [PATCH] remove unnecessary comparison with second match --- lib/ace/ext/whitespace.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/ace/ext/whitespace.js b/lib/ace/ext/whitespace.js index a6f316cf..b0b555fd 100644 --- a/lib/ace/ext/whitespace.js +++ b/lib/ace/ext/whitespace.js @@ -77,7 +77,6 @@ exports.$detectIndentation = function(lines, fallback) { changesTotal += changes[i]; var first = {score: 0, length: 0}; - var second = {score: 0, length: 0}; var spaceIndents = 0; for (var i = 1; i < 12; i++) { if (i == 1) { @@ -90,15 +89,11 @@ exports.$detectIndentation = function(lines, fallback) { score += changes[i] / changesTotal; } - if (score > first.score) { - second = first; + if (score > first.score) first = {score: score, length: i}; - } else if (score > second.score) { - second = {score: score, length: i}; - } } - if (second.score < 0.9 * first.score && first.score > 1.4) + if (first.score && first.score > 1.4) var tabLength = first.length; if (tabIndents > spaceIndents + 1)