Хелпикс

Главная

Контакты

Случайная статья





Display Editors



Display Editors

by Peter B. Smith

To begin with, we categorize as display editors those general purpose editors that enable a user to make changes to a document and see the effects of changes immediately, without having to issue additional commands. Such editors typically require a display with at least cursor addressing capabilities(rather than a teletype). Usual­ly a large portion of the display is dedicated to pro­viding

a window into the file buffer. The commonest conceptual model(due to Irons and Djorup) maps the text onto an infinitely extensible quarter plane. Imagine the file on a two dimensional plane with the first character of the first line at the origin. The user is free to write on the plane to the right and down from the origin. That is, there is no limit on the length of lines or on the number of lines. The editor enables the user to move around the quarter plane and to make changes to the display; using normal cursor control commands, the cursor cannot be moved above the first line of the file or to the left of the first character position on a line. While to the user it may appear that commands issued modify the file buffer and the display is then modified to represent the new buffer contents. Particular editors may implement extensions to the basic conceptual model. For example, there may be multiple windows into the file buff­er and there may be multiple buffer.

Process 2 Record of contents

Screen <— (screen updater) <-> of current screen

Keyboard

Process 1

(buffer updater) —» File buffer

In this figure Process 1 accepts commands from the keyboard and makes the appropriate changes to the file buffer. Process 2 looks at both the file buffer and a data structure that represents the current screen. It writes characters to 

the display depending on what the screen currently looks like. A typical alphanumeric screen is 24 by 80 characters so the current screen image would occupy about 2K bytes. So display editors vary in the relative properties that they give to the two processes of the figure above. It is a little annoying, for example, if the editor persists in redrawing part of the screen that is already out ofxiate. Fig. below shows a two overall strategies. In (a) the screen is completely updated after one com­mand before the next command is processed. In (b) re­painting may be interrupted to process a command.

command interpretation and screen updating strategies

(a) repeat if command to be interpreted

then Update file buffer

if screen out of date

then Update screen

until exit

(b) repeat while there is a command to be interpreted

update file buffer

while (screen is out of date) and no

command to be interpreted

update screen a little (more)

until exit

Next, terminals vary in the control characters that they use to direct cursor movement, perform scrolling, clear sections of the screen and so on. There will typically be some mechanism, such as virtual screens or an editor accessible file of terminals.

E

The e editor developed by the Rand Computation Center uses control characters for control functions, such as cursor movement and initiating string searches. Non-control characters are either inserted at the current cursor position or overwrite the character  at that position. Insert/Over- write mode is toggled with a simple command, an indicator on the screen indicates the current mode. The user can have multiple windows (possibly into different files); a "change window" command moves to the next window in a circular list. A keystroke history file is generated as the user types and, in the event of an uncontrolled exit, the history can be replayed. A variety of commands can be issued in "command mode" 'including some oriented towards document preparation such as filling and justification of paragraphs. The editor does unexpected things to tabs and spaces on lines that it modifies. Trailing tabs and spaces are deleted, groups of leading spaces are converted to tabs and embedded tabs are converted to spaces.

EMACS

EMACS is probably the most widely available full­ screen editor. Implementations of it, and clones are available on a large variety of sys from super computers to micros. There is even a USENET news- group (comp.emacs)

devoted to "EMACS editors of different flavors" One reason for its popularity is that its design enables it to be customized to suit particular users and applications; if necessary it can also be made to behave like a particular non EMACS editor.

And further. EMACS interprets user keystrokes using one or more tables, each of which has an entry for each ASCII character. The table entry for a character may specify a function to be carried out or may point to another table. If a function is performed, if the point­er points to another table than that table is used to interpret the next keystroke. In this way, multi charac­ter commands are implemented. For example, while control-L causes EMACS to redraw the screen, the effect of control-X depends on what follows it:

control — X control — 0 delete blank lines

control — X control — S save current file

control — X control — W resize window

There are sensible defaults, for example the graphic characters are bound to "self insert" — a function that causes them to be inserted into the file buffer at the current cursor position.

Moreover, a user can create a set of key-bindings and cause it to be loaded into the table(s). For example, the space character could be bound to a function that checks the location of the right margin and, if neces­sary , backs up and inserts a newline, thus providing auto-wrap. Similarly, a period could initiate the look­ up of the preceding symbol in a list of abbreviations. Closing brackets of various kinds could start a check for previously occurring opening ones. In particular, EMACS can be customized with routines knowing about the syntax and user-preferred format of certain program­ming languages, e.g., С and LISP. '

Disadvantages of EMACS are that it may be complex for a beginner to use, (but it can be made simple using the key-buildings) and that it requires more memory and CPU time than simple editors. Many concurrent EMACS users on a system can cause a noticeable performance degradation. Thus, the categories of editor we have looked at so far require progressively more sophisticated terminals.

Line and stream editors work on dumb terminals and dis­play editors require addressable screens.

 



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.