Text editor?

Started by
6 comments, last by stefu 20 years, 11 months ago
How do you store text in text editor? Not very practival to have just one big chunc. Is this good:

list< string > mLines;
 
Thanks!
Advertisement
what wrong with array of wchar or char
http://freespace.virgin.net/james.brown7/tuts/bigmem01.htm
http://freespace.virgin.net/james.brown7/tuts/bigmem02.htm
Linked lists sounds like a good solution to me. Text editors have lots of line insertions/deletions so having O(1) for those is pretty much top priority.
Ropes?

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
quote:Original post by Kylotan
Ropes?


Now, this is interesting. Could have whole text in single rope.

I am writing a little c++ editor. I still think that it would be good idea to use list of string (string for each line). Lines are not usually very long, so std::string would work just fine. Or propably list of ropes. Having big single rope, managing cursor (row,col) seems to be harder.
Download early vesion of Pulsar, C++ IDE: Pulsar.zip
Used ext/rope and wxWindows there
I''ve built an editor (wysiwyg java applet) where i used a linked list of strings (java''s StringBuffer class, which resembles std::string) with each string representing a paragraph (text between two newlines). That way, as long as the user hits enter every now and then insertion should not be too slow, and you also do not get a huge linked list that you would get if you used one big list of characters. In my implementation this worked fine (no performance issues at all, even though it used java). You''ll need to write some code for splitting/merging paragraphs but that is pretty straightforward.

Marijn

This topic is closed to new replies.

Advertisement