Write a brief note on Design of an Editor.

This question appears in Mumbai University > System programming and compiler construction subject

Marks: 5 M

Year: Dec 2015

1 Answer


• A text editor is a tool that allows a user to create and revise documents in a computer.

• Though this task can be carried out in other modes, the word text editor commonly refers to the tool that does this interactively.

• Earlier computer documents used to be primarily plain text documents, but nowadays due to improved input-output mechanisms and file formats, a document frequently contains pictures along with texts whose appearance (script, size, color and style) can be varied within the document.

• Apart from producing output of such wide variety, text editors today provide many advanced features of interactiveness and output.

Types of Text Editors

• Depending on how editing is performed, and the type of output that can be generated, editors can be broadly classified as -

  1. Line Editors:-
  2. During original creation lines of text are recognized and delimited by end-of-line markers, and during subsequent revision, the line must be explicitly specified by line number or by some pattern context. eg. edlin editor in early MS-DOS systems.

  3. Stream Editors:-

  4. The idea here is similar to line editor, but the entire text is treated as a single stream of characters. Hence the location for revision cannot be specified using line numbers. Locations for revision are either specified by explicit positioning or by using pattern context. eg. sed in Unix/Linux.Line editors and stream editors are suitable for text-only documents.

  5. Screen Editors:-

  6. These allow the document to be viewed and operated upon as a two dimensional plane, of which a portion may be displayed at a time. Any portion may be specified for display and location for revision can be specified anywhere within the displayed portion. eg. vi, emacs, etc.

  7. Word Processors:-

  8. Provides additional features to basic screen editors. Usually support non-textual contents and choice of fonts, style, etc.

  9. Structure Editors:-

  10. These are editors for specific types of documents, so that the editor recognizes the structure/syntax of the document being prepared and helps in maintaining that structure/syntax.

Editor Structure

  • Most text editors have a structure similar to that shown in the following figure.
  • Command language Processor accepts command, uses semantic routines – performs functions such as editing and viewing. The semantic routines involve traveling, editing, viewing and display functions.

enter image description here

  • Editing operations are specified explicitly by the user and display operations are specified implicitly by the editor. Traveling and viewing operations may be invoked either explicitly by the user or implicitly by the editing operations.
  • In editing a document, the start of the area to be edited is determined by the current editing pointer maintained by the editing component. Editing component is a collection of modules dealing with editing tasks. Current editing pointer can be set or reset due to next paragraph, next screen, cut paragraph, paste paragraph etc.
  • When editing command is issued, editing component invokes the editing filter – generates a new editing buffer – contains part of the document to be edited from current editing pointer.
  • Filtering and editing may be interleaved, with no explicit editor buffer being created.
  • In viewing a document, the start of the area to be viewed is determined by the current viewing pointer maintained by the viewing component.
  • Viewing component is a collection of modules responsible for determining the next view.
  • Current viewing pointer can be set or reset as a result of previous editing operation.
  • When display needs to be updated, viewing component invokes the viewing filter – generates a new viewing buffer – contains part of the document to be viewed from current viewing pointer.
  • In case of line editors – viewing buffer may contain the current line, Screen editors - viewing buffer contains a rectangular cutout of the quarter plane of the text.
  • Viewing buffer is then passed to the display component of the editor, which produces a display by mapping the buffer to a rectangular subset of the screen – called a window.
  • The editing and viewing buffers may be identical or may be completely disjoint. Identical – user edits the text directly on the screen.
  • Disjoint – Find and Replace (For example, there are 150 lines of text, user is in 100th line, decides to change all occurrences of ‘text editor’ with ‘editor’).
  • The editing and viewing buffers can also be partially overlap, or one may be completely contained in the other.
  • Windows typically cover entire screen or a rectangular portion of it. May show different portions of the same file or portions of different file.
  • Inter-file editing operations are possible.
  • The components of the editor deal with a user document on two levels: In main memory and in the disk file system.
  • Loading an entire document into main memory may be infeasible – only part is loaded – demand paging is used – uses editor paging routines.
  • Documents may not be stored sequentially as a string of characters.
  • Uses separate editor data structure that allows addition, deletion, and modification with a minimum of I/O and character movement.
Please log in to add an answer.

Continue reading...

The best way to discover useful content is by searching it.