Skip to content

Commit

Permalink
🐎 No need to paint tokens with only whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Apr 20, 2016
1 parent 64ef015 commit 359a30c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/mixins/canvas-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,12 @@ export default class CanvasDrawer extends Mixin {
for (let tokens of this.tokenLinesForScreenRows(firstRow, lastRow)) {
let x = 0
for (let token of tokens) {
const color = displayCodeHighlights ? this.getTokenColor(token) : this.getDefaultColor()
x = this.drawToken(context, token.value, color, x, y, charWidth, charHeight)
if (/^\s+$/.test(token.value)) {
x += token.value.length * charWidth
} else {
const color = displayCodeHighlights ? this.getTokenColor(token) : this.getDefaultColor()
x = this.drawToken(context, token.value, color, x, y, charWidth, charHeight)
}
if (x > canvasWidth) { break }
}

Expand Down

0 comments on commit 359a30c

Please sign in to comment.