apply to whitespace in general
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
ffa7ceb70e
commit
af4c95e267
1 changed files with 4 additions and 4 deletions
|
@ -18,8 +18,8 @@ import EditorModel from "./model";
|
||||||
import DocumentPosition, {Predicate} from "./position";
|
import DocumentPosition, {Predicate} from "./position";
|
||||||
import {Part} from "./parts";
|
import {Part} from "./parts";
|
||||||
|
|
||||||
const whileSpacePredicate: Predicate = (index, offset, part) => {
|
const whitespacePredicate: Predicate = (index, offset, part) => {
|
||||||
return part.text[offset] === " ";
|
return part.text[offset].trim() === "";
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class Range {
|
export default class Range {
|
||||||
|
@ -40,8 +40,8 @@ export default class Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
trim() {
|
trim() {
|
||||||
this._start = this._start.forwardsWhile(this.model, whileSpacePredicate);
|
this._start = this._start.forwardsWhile(this.model, whitespacePredicate);
|
||||||
this._end = this._end.backwardsWhile(this.model, whileSpacePredicate);
|
this._end = this._end.backwardsWhile(this.model, whitespacePredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
expandBackwardsWhile(predicate: Predicate) {
|
expandBackwardsWhile(predicate: Predicate) {
|
||||||
|
|
Loading…
Reference in a new issue