emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master ebc0b99 013/271: Add rollover font lock optimization.


From: Jackson Ray Hamilton
Subject: [elpa] master ebc0b99 013/271: Add rollover font lock optimization.
Date: Thu, 05 Feb 2015 18:29:25 +0000

branch: master
commit ebc0b9996d6701df7ccee1d7e5adee00ed8c0760
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Add rollover font lock optimization.
---
 scripts/tokenizer.js |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/scripts/tokenizer.js b/scripts/tokenizer.js
index b7b3268..14f4ed5 100644
--- a/scripts/tokenizer.js
+++ b/scripts/tokenizer.js
@@ -34,7 +34,8 @@ process.stdin.on('readable', function () {
 });
 
 process.stdin.on('end', function () {
-    var data, totals, out, i, tokens, length, token, origin, level, total;
+    var data, totals, out, i, tokens, length, token, origin, level, total,
+        previous;
 
     // Generate a syntax tree for the input.
     JSLINT(whole);
@@ -72,11 +73,17 @@ process.stdin.on('end', function () {
         }
         total = totals[token.line - 1];
 
-        out.push({
-            l: level,
-            s: total + token.from,
-            e: total + token.thru
-        });
+        previous = out[out.length - 1];
+
+        if (previous && previous.l === level) {
+            previous.e = total + token.thru;
+        } else {
+            out.push({
+                l: level,
+                s: total + token.from,
+                e: total + token.thru
+            });
+        }
 
         i += 1;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]