home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / editors / 2011 < prev    next >
Encoding:
Text File  |  1992-08-16  |  3.6 KB  |  80 lines

  1. Newsgroups: comp.editors
  2. Path: sparky!uunet!wupost!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!murphy!fortony
  3. From: fortony@sonne.cso.uiuc.edu
  4. Subject: buffer gap: actually writing an editor
  5. Message-ID: <fortony.714037868@murphy>
  6. Originator: fortony@murphy
  7. Summary: an actual article concerning editors! :)
  8. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  9. Organization: University of Illinois at Urbana
  10. Date: Mon, 17 Aug 1992 07:51:08 GMT
  11. Keywords: Finseth, Craft, Of, Text, Editing
  12. Lines: 66
  13.  
  14. Greets!  I just finished reading Finseth's fine _The Craft of
  15. Text Editing_ (forty bucks -- cha ching!).  Why?  Well, I'm
  16. going to try to write an editor.  And first, I've got a few
  17. questions.  They're going to be phrased in ANSI C.
  18.  
  19.     I'm having some problems imagining how I'd implement
  20. the buffer gap method.  Finseth says this is just a big
  21. contiguous block of memory divided into two bits, with
  22. pointers to the beginning and endings of both bits.  Let's
  23. call them the left bit and the right bit.  Now, if I am
  24. in a situation where the left bit is very small (say, a
  25. few lines down from the top of the file) but the right bit
  26. is very large (say, /usr/dict/words), then I can't figure
  27. out why I'm not really in trouble when I insert a character.
  28. The inserted character requires that the right bit be moved
  29. farther right out of the way in memory.  Depending on the
  30. size of the file and the efficiency of the memmove, this
  31. could take a really long time.  And in a modeless editor
  32. such as emacs -- where every typed character must be
  33. immediately added to the buffer -- this would have to
  34. happen every time you pressed a key.  Ideally, you could
  35. sneak the 'left bit' more left to make room for the
  36. inserted character, but decrementing pointers into 
  37. unallocated regions of memory is a bad idea, and there
  38. can exist no algorithm to correctly determine how much
  39. memory to preallocate for this purpose.
  40.     But people use emacs every day, some even happily.
  41. I must be missing something.
  42.  
  43.     My second dilemma is modelessness over modality.
  44. Please restrain all thoughts you may have on this point to
  45. technical discussion.  I'm thinking that modality is 
  46. basically 'control-lock'.  Instead of having to type
  47. ^F^F^F^F^F^D as per emacs, a user in vi can type 
  48. ESCkkkkkj(editing entry key), 'locking' the control key
  49. down until she 'unlocks' it with 'a' or 'r' or 'i' or
  50. whatever.  Finseth thinks this is disreputable behavior
  51. for an editor because users might not be able to figure
  52. out modes -- but he goes on to think that LISP is a great
  53. implementation and extension language which those same
  54. users would be using, so I'm kinda iffy.  Are there any
  55. studies on the average keypresses in, say, vi, versus
  56. the average keypresses (including the first press of 
  57. the bucky key[s]) in emacs?
  58.  
  59.     My third dilemma is emulation of virtual memory.
  60. As a maintainer of sun workstations, I am acutely aware
  61. that sensible programs can swap to disk much more sanely
  62. than the system.  However, increasing the number of
  63. boundaries a search or move can cross seems to get scary,
  64. especially when, as must be the case, the chunks of file
  65. can be of very different sizes.  A user might delete
  66. everything out of a chunk except for the letter 'a',
  67. for instance, and then issue a search for "*aa".  This
  68. would have the potential for seriously spamming the
  69. machine and/or the disk system if the chunk got swapped
  70. out.  What are currently accepted held beliefs concerning
  71. memory usage and well-behaved generic editors?
  72.  
  73.  
  74. e-mail to fortony@sonne.cso.uiuc.edu is great, but I
  75. imagine that other editor writers/admirers might
  76. appreciate the answers too.
  77. -- 
  78. a b c d e f g h i j k l m n o p q r s t u v w x y z
  79. Felix Sebastian Ortony    fortony@murphy.gis.uiuc.edu
  80.