summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2015-01-09 17:40:24 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2015-01-09 17:40:24 -0800
commit031a126b86c82fab47b5d87e34da31a7657a55d1 (patch)
treec8c57affb495942e90410ef3387239645d9e7eba
parent9bf2a0b1bcaff8f6c00d68cf40a99e4adebcb99b (diff)
JS: Improved end lines.
Closes #276.
-rw-r--r--js/lib/blocks.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 7972b09..fd51a4b 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -132,7 +132,7 @@ var addLine = function(ln, offset) {
var addChild = function(tag, line_number, offset) {
"use strict";
while (!canContain(this.tip.t, tag)) {
- this.finalize(this.tip, line_number);
+ this.finalize(this.tip, line_number - 1);
}
var column_number = offset + 1; // offset 0 = column 1
@@ -322,7 +322,7 @@ var incorporateLine = function(ln, line_number) {
var already_done = false;
// finalize any blocks not matched
while (!already_done && oldtip !== last_matched_container) {
- mythis.finalize(oldtip, line_number);
+ mythis.finalize(oldtip, line_number - 1);
oldtip = oldtip.parent;
}
already_done = true;
@@ -547,11 +547,7 @@ var finalize = function(block, line_number) {
return 0;
}
block.open = false;
- if (line_number > block.pos.start[0]) {
- block.pos.end = [line_number - 1]; // TODO end column
- } else {
- block.pos.end = [line_number];
- }
+ block.pos.end = [line_number]; // TODO end column
switch (block.t) {
case 'Paragraph':
@@ -659,7 +655,7 @@ var parse = function(input) {
this.incorporateLine(lines[i], i + 1);
}
while (this.tip) {
- this.finalize(this.tip, len - 1);
+ this.finalize(this.tip, len);
}
this.processInlines(this.doc);
return this.doc;