#chapter Text Processing

This chapter describes class editor and friends.  An editor is a
programmable text-editor.  The basic functionality is based on the
widespread GNU-EMACS editor.  Key sequences may be attached to methods
using the key_binding object.  Please try the PceEmacs demo to exploit
the capabilities of PCE's text processing primitives.

PCE editors handle multiple fonts (also proportional fonts) and styles
(underlined, highlighted, coloured).


ORGANISATION

The central class of this chapter is *editor*.  An editor is a subclass
of class device (compound graphical object), consisting of a text_image
object for displaying the actual text, a scroll_bar object for
pointer-based scrolling and a text_cursor object for displaying the
caret.  Besides this, an editor references a text_buffer object.  A
text_buffer represents a sequence of characters, low-level editing
facilities and a mechanism for collecting changes and forwarding them
to the related editors (a text_buffer may be connected to any number of
editors simultanously).  Finally, an editor has a key_binding object
that maps key-strokes onto methods defined on the editor.  See `editor
->event', `editor <-bindings' and class key_binding.

Class *fragment* describes a range of characters in a text_buffer.  Such
a range may be assigned attributes using a *style* object.  This
realises *multiple* *fonts*, colours, underlined and highlighted text,
etc.  See also `editor ->style'.
#end chapter

#class view
#end class

#class editor
#description group read
Reading lines and words from an editor.  These methods are useful for
interpreting the contents of an editor.  Examples may be
`jump-to-definition' expoiting <-word to find the name whose definition
is requested.  Note that class regex (regular expressions) form a much
more powerful mechanism to extract content from an editor.
#end description

#description group search
The methods of this sections are `ready-to-go' methods for interactive
usage.  Related methods are `text_buffer <-find' and `regex ->search'.
#end description

#description group delete
The editor knows about two types of deletion: if text is just deleted,
it may only be recovered using ->undo.  If it is *killed* it will be placed
in the kill-ring and may be ->yank'ed back.  All deletion commands that
actually kill have the string `kill' in their name.
#end description

#description group edit_continue
The methods in this group are the `continue' methods for the methods
with the same name except for the leading `_'.  See also <-focus_function.
#end description

#description group line
The commands of this section deal with manipulating lines.  They
originate from the days that a browser was implemented on top of a
view (editor).  As they may be useful when handling line-numbered
reports from compilers, etc. they will be retained.

The first line is always numbered 1.
#end description

#end class

#class text_buffer
#description group read
Getting text from a text_buffer.  Note that class editor defines
various other methods for this. Class regex (regular expressions)
may also be considered.
#end description

#description group language
The methods from this group are designed first of all to define
syntax-driven editors (notably automatic indentation).  The demo
program PceEmacs exploits these methods to implement automatic
indentation for Prolog and C.

Most of these methods exploit the associated syntax_table object.
See <-syntax.
#end description

#description group fragment
These methods allow for scanning the associated fragment objects.
Fragments are created and modified using methods on class fragment
itself.
#end description
#end class

#class regex
#end class

#class fragment
#end class

#class style
#end class

#class key_binding
#end class

#class text_image
#end class

#class text_margin
#end class

#class text_cursor
#end class
