mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Never break when past the last row
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user