Fix foldBufferRow regression

This commit is contained in:
Max Brunsfeld 2018-01-18 09:38:30 -08:00
parent 09751855b5
commit a4e011d3b8
2 changed files with 15 additions and 1 deletions

View File

@ -912,6 +912,20 @@ describe('TextMateLanguageMode', () => {
}
`)
range = languageMode.getFoldableRangeContainingPoint(Point(7, 0), 2)
expect(simulateFold([range])).toBe(dedent `
if (a) {
b();
if (c) {
}
h()
}
i()
if (j) {
k()
}
`)
range = languageMode.getFoldableRangeContainingPoint(Point(1, Infinity), 2)
expect(simulateFold([range])).toBe(dedent `
if (a) {

View File

@ -605,7 +605,7 @@ class TextMateLanguageMode {
for (let row = point.row - 1; row >= 0; row--) {
const endRow = this.endRowForFoldAtRow(row, tabLength)
if (endRow != null && endRow > point.row) {
if (endRow != null && endRow >= point.row) {
return Range(Point(row, Infinity), Point(endRow, Infinity))
}
}