Make sure to roll back the generated position markers when trimming spaces.

This commit is contained in:
Logan Smyth 2016-04-15 21:54:19 -07:00
parent 9ddf9aabfc
commit 2f790889eb

View File

@ -224,8 +224,10 @@ export default class Buffer {
_removeSpacesAfterLastNewline() {
let lastNewlineIndex = this.buf.lastIndexOf("\n");
if (lastNewlineIndex >= 0 && this.get().length <= lastNewlineIndex) {
let toRemove = this.buf.slice(lastNewlineIndex + 1);
this.buf = this.buf.substring(0, lastNewlineIndex + 1);
this.last = "\n";
this.position.unshift(toRemove);
}
}