Page 242 Table of Contents Index Page 244
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 24. INPUT EDITING AND COMPLETION FACILITIES

The input editing stream may also have other components to store internal state, such as a slot
to accumulate a numeric argument or remember the most recently used presentation history,
and so forth. These other components are explicitly left unspecified.

The high level description of the operation of the input editor is that it reads either "real"
gestures from the user (such as characters from the keyboard or pointer button events) or input
editing commands. The input editing commands can modify the state of the input buffer. When
such modifications take place, it is necessary to "rescan" the input buffer, that is, reset the scan
pointer SP to its original state and reparse the contents of the input editor buffer before reading
any other gestures from the user. While this rescanning operation is taking place, the "rescan
in progress" flag is set to true. The relationship SP <= IP <= FP always holds.

The overall control structure of the input editor is:

 (catch 'rescan ;thrown to when a rescan is invoked
   (reset-scan-pointer stream) ;sets STREAM-RESCANNING-P to T
   (loop
     (funcall continuation stream)))

where stream is the input editing stream and continuation is the code supplied by the pro-
grammer, and typically contains calls to such functions as accept and read-token (which will
eventually call stream-read-gesture). When a rescan operation is invoked, it has the effect of
throwing to the rescan tag in the example above. The loop is terminated when an activation
gesture is seen, and at that point the values produced by continuation are returned as values
from the input editor.

The important point is that functions such as accept, read-gesture, and unread-gesture
read (or restore) the next gesture object from the buffer at the position pointed to by the scan
pointer SP. However, insertion and input editing commands take place at the position pointed
to by IP. The purpose of the rescanning operation is to eventually ensure that all the input
gestures issued by the user (typed characters, pointer button presses, and so forth) have been
read by CLIM. During input editing, the input editor should maintain some sort of visible cursor
to remind the user of the position of IP.

The overall structure of stream-read-gesture on an input editing stream is:

 (progn
   (rescan-if-necessary stream)
   (loop
     ;; If SP is less than FP
     ;; Then get the next gesture from the input editor buffer at SP
     ;; and increment SP
     ;; Else read the next gesture from the encapsulated stream
     ;; and insert it into the buffer at IP
     ;; Set the "rescan in progress" flag to false
     ;; Call STREAM-PROCESS-GESTURE on the gesture
     ;; If it was a "real" gesture
     ;; Then exit with the gesture as the result


Page 242 Table of Contents Index Page 244
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E