point>loc ( point editor -- loc )


Vocabulary
ui.gadgets.editors

Inputs and outputs
pointa pair of integers
editoran editor
loca pair of integers


Word description
Converts a point to a line/column number pair.

Definition
USING: accessors arrays combinators documents kernel locals
locals.prettyprint math sequences ui.gadgets.line-support
ui.text ;

IN: ui.gadgets.editors

:: point>loc ( point editor -- loc )
point second editor y>line {
{ [ dup 0 < ] [ drop { 0 0 } ] }
{
[ dup editor model>> last-line# > ]
[ drop editor model>> doc-end ]
}
[| n |
n point first editor font>> n editor editor-line
x>offset 2array
]
} cond ;