[extensions-web] js: Lines without known sequences shouldn't be highlighted.



commit 2bf7466a5e4582481ec74f0e028011e371507c6e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jun 15 16:39:41 2012 -0400

    js: Lines without known sequences shouldn't be highlighted.

 sweettooth/static/js/diff.js |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/sweettooth/static/js/diff.js b/sweettooth/static/js/diff.js
index b43e8d1..3219504 100644
--- a/sweettooth/static/js/diff.js
+++ b/sweettooth/static/js/diff.js
@@ -99,14 +99,10 @@ define(['jquery'], function($) {
         function unchanged(text) { return span('unchanged', text); }
         function changed(text) { return span('changed', text); }
 
-        // We don't want anything fancy for delete/inserted chunks.
-        if (regions === undefined)
-            return unchanged(contents);
-
         // If there's no region, then SequentialMatcher failed to
-        // find something useful (or the ratio was too low). Just
-        // highlight the entire region as changed.
-        if (regions === null || regions.length === 0)
+        // find something useful, or we're in a regular delete/inserted
+        // chunk. Highlight the entire region as unchanged.
+        if (!regions || regions.length === 0)
             return changed(contents);
 
         var regionElems = [];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]