Can anyone tell me where to find info in designing a text editor??
More specific:
i want to know what's the best way to organize the data (chars)...what data structure to use...
and which functions will help me navigate in the text.
Thanks.
Can anyone tell me where to find info in designing a text editor??
More specific:
i want to know what's the best way to organize the data (chars)...what data structure to use...
and which functions will help me navigate in the text.
Thanks.
Perhaps a linked list of linked lists. 1 entry in the "base list" for each "line", one node in each line list for each word.
While this sounds like an OK way to do it, you may want just a single linked list. This would be the easiest, in that you could automaticly handle line-wrap by simply displaying each "word" and once your "current_line_length + next_word_length > max_line_length", then just put that on a new line.
You then can easily create search functions, also you can track the current word you're at, and even the current letter in said word.
Quzah.
You could start here
http://directory.google.com/Top/Comp...tware/Editors/
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You can get the source code vim and study how they have done it
http://www.vim.org/download.html