When writing a text editor, there needs to be a data structure that simply can convert a line number to a document offset. A naive implementation would be an (array) list of document offsets, but this has the disadvantage that when inserting text at the beginning, all (!) higher line offsets would have to be incremented and/or shifted (for entered new lines). What tree-like data structure is recommended to only have to update ideally 1 or just a few elements - by allowing the access of the document offset to become a little bit slower?When writing a text editor, there needs to be a