From 031a126b86c82fab47b5d87e34da31a7657a55d1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 9 Jan 2015 17:40:24 -0800 Subject: JS: Improved end lines. Closes #276. --- js/lib/blocks.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'js/lib/blocks.js') 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; -- cgit v1.2.3