mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Handle empty client rects in LinesYardstick
getBoundingClientRect returns garbage values if the range has zero width, which it does in the case of a fold placeholder or any other zero-width character. Sometimes getClientRects() returns an empty list, so we fall back to the bounding rect in these cases.
This commit is contained in:
@@ -108,4 +108,4 @@ class LinesYardstick
|
||||
clientRectForRange: (textNode, startIndex, endIndex) ->
|
||||
@rangeForMeasurement.setStart(textNode, startIndex)
|
||||
@rangeForMeasurement.setEnd(textNode, endIndex)
|
||||
@rangeForMeasurement.getBoundingClientRect()
|
||||
@rangeForMeasurement.getClientRects()[0] ? @rangeForMeasurement.getBoundingClientRect()
|
||||
|
||||
Reference in New Issue
Block a user