Skip to content

Commit

Permalink
🐛 Fix reading tokens from undefined lines
Browse files Browse the repository at this point in the history
Fixes #341
  • Loading branch information
abe33 committed Jun 10, 2015
1 parent 1ae73d9 commit a5bcc7a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/mixins/canvas-drawer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,23 @@ class CanvasDrawer extends Mixin
@drawHighlightDecoration(context, decoration, y, screenRow, lineHeight, charWidth, canvasWidth)

# Then the line tokens are drawn
for token in line.tokens
w = token.screenDelta
unless token.isOnlyWhitespace()
color = if displayCodeHighlights
@getTokenColor(token)
if line?.tokens?
for token in line.tokens
w = token.screenDelta
unless token.isOnlyWhitespace()
color = if displayCodeHighlights
@getTokenColor(token)
else
@getDefaultColor()

value = token.value
value = value.replace(invisibleRegExp, ' ') if invisibleRegExp?

x = @drawToken(context, value, color, x, y0, charWidth, charHeight)
else
@getDefaultColor()
x += w * charWidth

value = token.value
value = value.replace(invisibleRegExp, ' ') if invisibleRegExp?

x = @drawToken(context, value, color, x, y0, charWidth, charHeight)
else
x += w * charWidth

break if x > canvasWidth
break if x > canvasWidth

# Finally the highlight over decorations are drawn.
highlightDecorations = decorations['highlight-over']?[firstRow + row]
Expand Down

0 comments on commit a5bcc7a

Please sign in to comment.