Skip to content

Commit

Permalink
🐛 Fix folding/unfolding rows giving invalid redraw range
Browse files Browse the repository at this point in the history
Fixes #429
  • Loading branch information
abe33 committed Dec 16, 2015
1 parent aef0c49 commit 8d0f061
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/mixins/canvas-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ export default class CanvasDrawer extends Mixin {
offscreenRow: range.offscreenRow
})
} else if (change.end < range.start || change.start > range.end) {
// The change is outside the range but didn't added
// or removed lines
// The change is outside the range but didn't add
// or remove lines
newIntactRanges.push(range)
} else {
// The change is within the range, there's one intact range
Expand All @@ -719,6 +719,15 @@ export default class CanvasDrawer extends Mixin {
end: range.end + change.screenDelta,
offscreenRow: range.offscreenRow + change.end + 1 - range.start
})
} else if (change.screenDelta !== 0) {
// Lines are added or removed in the display buffer, the intact
// range starts in the next line after the change end plus the
// screen delta
newIntactRanges.push({
start: change.end + change.screenDelta + 1,
end: range.end + change.screenDelta,
offscreenRow: range.offscreenRow + change.end + 1 - range.start
})
} else {
// No lines are added, the intact range starts on the line after
// the change end
Expand Down

0 comments on commit 8d0f061

Please sign in to comment.