     [ f CTLineGetOffsetForStringIndex round ] bi-curry@ bi
     [ drop nip 0 ] [ swap - swap second ] 3bi <CGRect> ;
 
+: CGRect-translate-x ( CGRect x -- CGRect' )
+    [ dup CGRect-x ] dip - over set-CGRect-x ;
+
 :: fill-selection-background ( context loc dim line string -- )
     string selection? [
         context string color>> >rgba-components CGContextSetRGBFillColor
         context dim line string selection-rect
-        dup CGRect-x loc first - over set-CGRect-x
+        loc first CGRect-translate-x
         CGContextFillRect
     ] when ;
 

        f line boa
    ] with-destructors ;

M: line dispose* [ font>> CFRelease ] [ line>> CFRelease ] bi ;

SYMBOL: cached-lines



:: <line> ( font string -- line )
    [
        [let* | open-font [ font cache-font ]
                line [ string open-font font foreground>> <CTLine> |CFRelease ]

                rect [ line line-rect ]
