4 The core text management data structure which supports efficient
5 modifications and provides a byte string interface. Text positions
6 are represented as ``size_t``. Valid addresses are in range ``[0,
7 text_size(txt)]``. An invalid position is denoted by ``EPOS``. Access to
8 the non-contigiuos pieces is available by means of an iterator interface
9 or a copy mechanism. Text revisions are tracked in an history graph.
11 .. note:: The text is assumed to be encoded in `UTF-8 <https://tools.ietf.org/html/rfc3629>`_.
16 .. doxygengroup:: load
22 .. doxygengroup:: state
28 .. doxygengroup:: modify
34 The individual pieces of the text are not necessarily stored in a
35 contiguous memory block. These functions perform a copy to such a region.
37 .. doxygengroup:: access
43 An iterator points to a given text position and provides interfaces to
44 adjust said position or read the underlying byte value. Functions which
45 take a ``char`` pointer will generally assign the byte value *after*
46 the iterator was updated.
48 .. doxygenstruct:: Iterator
50 .. doxygengroup:: iterator
56 .. note:: For a read attempt at EOF (i.e. `text_size`) an artificial ``NUL``
57 byte which is not actually part of the file is returned.
59 .. doxygengroup:: iterator_byte
65 These functions advance to the next/previous leading byte of an UTF-8
66 encoded Unicode codepoint by skipping over all continuation bytes of
67 the form ``10xxxxxx``.
69 .. doxygengroup:: iterator_code
75 These functions advance to the next/previous grapheme cluster.
77 .. note:: The grapheme cluster boundaries are currently not implemented
78 according to `UAX#29 rules <http://unicode.org/reports/tr29>`_.
79 Instead a base character followed by arbitrarily many combining
80 character as reported by ``wcwidth(3)`` are skipped.
82 .. doxygengroup:: iterator_char
88 Translate between 1 based line numbers and 0 based byte offsets.
90 .. doxygengroup:: lines
96 Interfaces to the history graph.
98 .. doxygengroup:: history
104 A mark keeps track of a text position. Subsequent text changes will update
105 all marks placed after the modification point. Reverting to an older text
106 state will hide all affected marks, redoing the changes will restore them.
108 .. warning:: Due to an optimization cached modifications (i.e. no ``text_snaphot``
109 was performed between setting the mark and issuing the changes) might
110 not adjust mark positions accurately.
112 .. doxygentypedef:: Mark
114 .. doxygendefine:: EMARK
116 .. doxygengroup:: mark
122 .. doxygengroup:: save
128 .. doxygengroup:: misc