ollef / rope-utf16-splay

Thick strings optimised for indexing and updating using UTF-16 code units and row/column pairs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

codeUnitsRowColumn as companion to rowColumnCodeUnits

alanz opened this issue · comments

We have

rowColumnCodeUnits :: RowColumn -> Rope -> Int

Can we have the inverse

codeUnitsRowColumn :: Int -> Rope -> RowColumn

It looks like it should be some combination of splitAt and measure

And it seems that what I am looking for is

codeUnitsRowColumn :: Int -> Rope ->RowColumn
codeUnitsRowColumn offset rope = rowColumn . measure . fst $ splitAt offset rope

Sounds good. Wanna create a PR with that?