JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
chrome bugfix: cursor at end in pre-wrap
authorJason Woofenden <jason@jasonwoof.com>
Sun, 20 Mar 2016 00:52:04 +0000 (20:52 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Sun, 20 Mar 2016 00:52:04 +0000 (20:52 -0400)
editor.coffee

index e32d662..7c57510 100644 (file)
@@ -121,7 +121,13 @@ text_range_bounds = (el, start, end) ->
        range.setEnd el, end
        rects = range.getClientRects()
        if rects.length > 0
-               rect = rects[0]
+               if rects.length > 1
+                       if rects[1].width > rects[0].width
+                               rect = rects[1]
+                       else
+                               rect = rects[0]
+               else
+                       rect = rects[0]
        else
                return null
        doc = el.ownerDocument.documentElement