summaryrefslogtreecommitdiff
path: root/js/lib/blocks.js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-17 16:46:06 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-17 16:46:06 -0800
commit43c8bebe9bce4201982485d63cf1c7ed18798574 (patch)
tree5307601da2fc8794f1812339619ea844b6656426 /js/lib/blocks.js
parent54817291035357d0265200eae36dc8aea9e6ef08 (diff)
addLine: use this.offset; removed offset parameter.
Diffstat (limited to 'js/lib/blocks.js')
-rw-r--r--js/lib/blocks.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 92d13fd..d2072c6 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -142,11 +142,11 @@ var breakOutOfLists = function(block) {
// Add a line to the block at the tip. We assume the tip
// can accept lines -- that check should be done before calling this.
-var addLine = function(ln, offset) {
+var addLine = function(ln) {
if (!(this.tip._open)) {
throw { msg: "Attempted to add line (" + ln + ") to closed container." };
}
- this.tip._strings.push(ln.slice(offset));
+ this.tip._strings.push(ln.slice(this.offset));
};
// Add block of type tag as a child of the tip. If the tip can't
@@ -491,7 +491,7 @@ var incorporateLine = function(ln) {
// lazy paragraph continuation
this._lastLineBlank = false;
- this.addLine(ln, this.offset);
+ this.addLine(ln);
} else { // not a lazy continuation
@@ -523,7 +523,7 @@ var incorporateLine = function(ln) {
switch (t) {
case 'HtmlBlock':
case 'CodeBlock':
- this.addLine(ln, this.offset);
+ this.addLine(ln);
break;
case 'Header':
@@ -532,14 +532,15 @@ var incorporateLine = function(ln) {
break;
default:
+ this.offset = first_nonspace;
if (acceptsLines(t)) {
- this.addLine(ln, first_nonspace);
+ this.addLine(ln);
} else if (blank) {
break;
} else {
// create paragraph container for line
- container = this.addChild('Paragraph', this.lineNumber, first_nonspace);
- this.addLine(ln, first_nonspace);
+ container = this.addChild('Paragraph', this.lineNumber, this.offset);
+ this.addLine(ln);
}
}
}