Given a line-object and a position within
that line, this function tries to find the field
containing that position.
There are three cases:
If the position is before the
line's tail, we return a field-object describing the head.
If the
position is within the tail, we return a field-object describing whichever field contains
that position.
If the position is past the tail, we
return nil.
This function just checks for the first case. If the
position isn't before the tail, we call Section 4.10, “bracket-tail-field: What tail field
contains the cursor?”.
;; - - - b r a c k e t - f i e l d - - -
(defun bracket-field (line p)
"Find the field containing a position p within a line-object line
[ if (line is a line-object for a line with a tail)
and (p is a position within line) ->
if p is in the head part of line ->
return a field-object representing the head part, with nil filler
else if p is in a tail field of line ->
return a field-object representing that field
else ->
return nil ]
----------------------------------------------------------------"
(if (< p (line-tail line))
(field-object (line-beg line) (line-tail line) nil)
(bracket-tail-field line)))