How to use custom data structure for `text_editor` content

Currently, the text_editor widget stores data in Content structure but I want to used my own implementation of GapBuffer, how can I achieve this? Do I need to make custom widget for this?

Based on my knowledge, the text_editor widget is heavily based on cosmic_text::Editor which is stored in the Content.
Based on that, I think it would be difficult to change the underlying mechanic to use some GapBuffer (not sure what this is → only read the Wikipedia summary).

Yah, my conclusion is same after digging deep in the source code.