Thread: Designing An Editor

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    11

    Question Designing An Editor

    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.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  4. #4
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    You can get the source code vim and study how they have done it
    http://www.vim.org/download.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WYSIWYG editor problem
    By Akkernight in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 08:50 AM
  2. Replies: 19
    Last Post: 05-30-2007, 05:47 PM
  3. Replies: 12
    Last Post: 08-05-2003, 02:16 PM
  4. OpenGL terrain demo (EDITOR)
    By Jeremy G in forum Game Programming
    Replies: 2
    Last Post: 03-30-2003, 08:11 PM
  5. PFE (prorgammers file editor, for Windows)
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-09-2002, 11:01 AM