rhysd/tui-textarea

What's your text buffer storage implement?

Zaplae opened this issue · 1 comments

Zaplae commented

Hello, this crate is awesome, but I want to know the performance of it compare to ropey(I want to write an editor and use this crate)
What's your data structure for text storage?

The reason why I opend this issue is that ropey is a useful crate for text editng, and I want to integrate it with your crate, for best editing performance

rhysd commented

What's your data structure for text storage?

The text buffer implementation is a very simple array of line strings. The reason is its simplicity.

I know more efficient data structures for text editing such as gap buffer, piece table, rope, etc... but they are complicated. The reason to adopt them is their efficiency. However, no one haven't claimed about the performance of this crate. So the efficiency would not benefit no one for now (as far as I know). On the other hand, they have an obvious cons that they bring complexity and more external dependency. That's why I don't adopt them.

I want to write an editor and use this crate

I don't recommend using this crate for 'serious' text editor implementation. That's why I named this crate tui-textarea, not tui-text-editor. This crate aims to implement something like HTML's <textarea> in terminal. (No one would think to use <textarea> for serious text editor implementation.)

This crate has only very basic features for text editing. You'll soon find that this crate does not meet all of your text editor's requirements. I strongly recommend you creating your own TUI implementation built on top of great terminal libraries such as crossterm or termwiz directly.