diff options
Diffstat (limited to 'space.js')
-rw-r--r-- | space.js | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -53,6 +53,7 @@ function Space(){ } this.towrite = function(){ // Does no splitting or anything like that. Just returns a list of triplets for the write function + if (this.loc[0] === undefined) throw "Space.towrite() requires valid loc"; let writes = []; for (let line = 0; line < this.data.length; line++) for (let chr = 0; chr < this.data[line].length; chr++){ if (this.data[line][chr] == '') continue; // Internal coding for "do not write" @@ -138,6 +139,7 @@ function Space(){ } this.subsection = function(range){ // range is a coordinate pair + if (range.length !== 2 || range[0].length !== 2) throw "not subsecting a coord pair"; // Similarly excludes this.loc newspace = new Space(); for (let line=range[0][0]; line<range[1][0]; line++){ @@ -147,6 +149,7 @@ function Space(){ newspace.data[line-range[0][0]].push(thisline[chr] || ''); } } + newspace.loc = [range[0][0], range[0][1]]; return newspace; } |