Implement IBuffer.getWrappedRangeForLine

Part of #1456
This commit is contained in:
Daniel Imms
2018-06-02 17:53:35 -07:00
parent c192a27d93
commit 285911cd98
4 changed files with 65 additions and 0 deletions
+14
View File
@@ -259,6 +259,20 @@ export class Buffer implements IBuffer {
return lineString.substring(startIndex, endIndex);
}
public getWrappedRangeForLine(y: number): { first: number, last: number } {
let first = y;
let last = y;
// Scan upwards for wrapped lines
while (first > 0 && (<any>this.lines.get(first)).isWrapped) {
first--;
}
// Scan downwards for wrapped lines
while (last + 1 < this.lines.length - 1 && (<any>this.lines.get(last + 1)).isWrapped) {
last++;
}
return { first, last };
}
/**
* Setup the tab stops.
* @param i The index to start setting up tab stops from.