Automatically prepend a space when writing a word immediately after a word.

This commit is contained in:
Logan Smyth 2016-04-30 14:24:51 -07:00
parent 4286cb4f2a
commit 39896b4d91

View File

@ -26,6 +26,7 @@ export default class Buffer {
column: null,
filename: null,
};
this._endsWithWord = false;
}
printedCommentStarts: Object;
@ -139,7 +140,10 @@ export default class Buffer {
*/
word(str: string) {
if (this._endsWithWord) this.push(" ");
this.push(str);
this._endsWithWord = true;
}
/**
@ -325,6 +329,9 @@ export default class Buffer {
this.position.push(str);
this.buf += str;
this.last = str[str.length - 1];
// Clear any state-tracking flags that may have been set.
this._endsWithWord = false;
}
/**