[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6e991c4 014/271: Fix off-by-one error.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 6e991c4 014/271: Fix off-by-one error. |
Date: |
Thu, 05 Feb 2015 18:29:25 +0000 |
branch: master
commit 6e991c4564940096c4b00558b6667eaf05bdd689
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Fix off-by-one error.
---
scripts/tokenizer.js | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/tokenizer.js b/scripts/tokenizer.js
index 14f4ed5..5475953 100644
--- a/scripts/tokenizer.js
+++ b/scripts/tokenizer.js
@@ -20,6 +20,7 @@ var JSLINT = require('./jslint'),
totals[i + 1] = total;
i += 1;
}
+ // Last line is a newline.
totals[i + 1] = total + 1;
return totals;
};
@@ -34,7 +35,7 @@ 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, cap, token, origin, level, total,
previous;
// Generate a syntax tree for the input.
@@ -48,6 +49,7 @@ process.stdin.on('end', function () {
i = 0;
tokens = data.tokens;
length = tokens.length;
+ cap = Math.min.bind(null, whole.length + 1);
while (i < length) {
token = tokens[i];
@@ -76,12 +78,12 @@ process.stdin.on('end', function () {
previous = out[out.length - 1];
if (previous && previous.l === level) {
- previous.e = total + token.thru;
+ previous.e = cap(total + token.thru);
} else {
out.push({
l: level,
- s: total + token.from,
- e: total + token.thru
+ s: cap(total + token.from),
+ e: cap(total + token.thru)
});
}
- [elpa] master updated (c8087b9 -> dc9644e), Jackson Ray Hamilton, 2015/02/05
- [elpa] master e3fc05a 011/271: Create bin and scripts directories., Jackson Ray Hamilton, 2015/02/05
- [elpa] master aaf199e 006/271: Fix global wraparound., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 809d48b 020/271: Minor tweaks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 98df7db 010/271: Optimize cli a little bit., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 5fd312b 002/271: More planning and research., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ebc0b99 013/271: Add rollover font lock optimization., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 615ce2c 004/271: Wow, actually works., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6d79b91 024/271: Idly colorizing after changes working. Cancelling seemingly not working., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fd4b629 007/271: Add mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6e991c4 014/271: Fix off-by-one error.,
Jackson Ray Hamilton <=
- [elpa] master b35380b 019/271: Vastly improve idle timer strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7ac8db6 012/271: Fix a bug where strings were matched., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 806398e 016/271: Use asynchronous command execution strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d0f5470 022/271: Successfully lexically bind buffer., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 397ef04 005/271: Detect globals., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 409a05b 017/271: Enable font lock again., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a72314c 008/271: Write temp files., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6a2a7df 018/271: Use idle timers instead of font lock., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 0a4248b 009/271: Update chunk size., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ffd69f5 026/271: Minutia., Jackson Ray Hamilton, 2015/02/05