mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge pull request #16588 from atom/mb-fix-fold-buffer-row
Fix incorrect fold when folding at the last line of an indented block
This commit is contained in:
@@ -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) {⋯
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user