阅读背景:

文本编辑器 - 偏移数据结构的行

来源:互联网 

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




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: