Never break when past the last row

This commit is contained in:
Kevin Sawicki
2014-10-16 17:01:18 -07:00
parent 111b956f93
commit f81bc4b870

View File

@@ -662,7 +662,7 @@ class DisplayBuffer extends Model
targetLeft = pixelPosition.left
defaultCharWidth = @defaultCharWidth
row = Math.floor(targetTop / @getLineHeightInPixels())
isLastRow = row > @getLastRow()
pastLastRow = row > @getLastRow()
row = Math.min(row, @getLastRow())
row = Math.max(0, row)
@@ -670,14 +670,11 @@ class DisplayBuffer extends Model
column = 0
for token in @tokenizedLineForScreenRow(row).tokens
charWidths = @getScopedCharWidths(token.scopeDescriptor)
if !isLastRow
for char in token.value
charWidth = charWidths[char] ? defaultCharWidth
break if targetLeft <= left + (charWidth / 2)
left += charWidth
column++
else
column = token.value.length
for char in token.value
charWidth = charWidths[char] ? defaultCharWidth
break if not pastLastRow and targetLeft <= left + (charWidth / 2)
left += charWidth
column++
new Point(row, column)