diff --git a/lib/mixins/canvas-drawer.js b/lib/mixins/canvas-drawer.js index 1640776d..cd35a9f8 100644 --- a/lib/mixins/canvas-drawer.js +++ b/lib/mixins/canvas-drawer.js @@ -300,7 +300,7 @@ export default class CanvasDrawer extends Mixin { for (let i = 0, len = ranges.length; i < len; i++) { const range = ranges[i] - method.call(this, currentRow, range.start - 1, currentRow - firstRow) + method.call(this, currentRow, range.start, currentRow - firstRow) currentRow = range.end } @@ -477,6 +477,7 @@ export default class CanvasDrawer extends Mixin { let y = offsetRow * lineHeight for (let tokens of this.tokenLinesForScreenRows(firstRow, lastRow)) { let x = 0 + context.clearRect(x, y, canvasWidth, lineHeight) for (let token of tokens) { if (/^\s+$/.test(token.value)) { x += token.value.length * charWidth @@ -593,6 +594,11 @@ export default class CanvasDrawer extends Mixin { drawDecorations (screenRow, decorations, renderData, types) { let decorationsToRender = [] + renderData.context.clearRect( + 0, renderData.yRow, + renderData.canvasWidth, renderData.lineHeight + ) + for (let i in types) { decorationsToRender = decorationsToRender.concat( decorations[i] != null ? decorations[i][screenRow] || [] : []