mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Fix logic for updating foldable range cache
This commit is contained in:
@@ -41,15 +41,12 @@ class TreeSitterLanguageMode {
|
||||
this.emitRangeUpdate = this.emitRangeUpdate.bind(this)
|
||||
|
||||
this.subscription = this.buffer.onDidChangeText(({changes}) => {
|
||||
for (let i = changes.length - 1; i >= 0; i--) {
|
||||
for (let i = 0, {length} = changes; i < length; i++) {
|
||||
const {oldRange, newRange} = changes[i]
|
||||
const startRow = oldRange.start.row
|
||||
const oldEndRow = oldRange.end.row
|
||||
const newEndRow = newRange.end.row
|
||||
this.isFoldableCache.splice(
|
||||
startRow,
|
||||
oldEndRow - startRow,
|
||||
...new Array(newEndRow - startRow)
|
||||
newRange.start.row,
|
||||
oldRange.end.row - oldRange.start.row,
|
||||
...new Array(newRange.end.row - newRange.start.row)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user