mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
Fix screenPositionForPixelPosition for case above first row.
Currently screenPositionForPixelPosition special cases pixel positions below the last row so that the column position is always set to the last column of the last line, even if the pixel 'x' position is less then that column. This patch special cases picks above the first row so that the text column position will be in the first column even if the pixel 'x' position is greater then that column. At a higher level, this patch fixes the problem where you can’t select to the start of a text field by just clicking and dragging up. Instead you have to click and drag back (x axis) beyond the start of the text field.
This commit is contained in:
@@ -692,6 +692,7 @@ class DisplayBuffer extends Model
|
||||
targetLeft = pixelPosition.left
|
||||
defaultCharWidth = @defaultCharWidth
|
||||
row = Math.floor(targetTop / @getLineHeightInPixels())
|
||||
targetLeft = -Infinity if row < 0
|
||||
targetLeft = Infinity if row > @getLastRow()
|
||||
row = Math.min(row, @getLastRow())
|
||||
row = Math.max(0, row)
|
||||
|
||||
Reference in New Issue
Block a user