-// this probably could be improved by using <cstddef>...
-#include <vector>
-
-namespace lyx
-{
- /// a type for positions used in paragraphs
- // needs to be signed for a while to hold the special value -1 that is
- // used there...
- typedef std::vector<char>::difference_type pos_type;
+#include <cstddef>
+
+namespace lyx {
+
+ /*!
+ * A type for positions used in paragraphs.
+ * Each position is either occupied by a single character or an inset.
+ * For insets, the placeholder META_INSET is stored in the paragraph
+ * text, and the actual insets are maintained separately.
+ */
+ // FIXME: should be unsigned, but needs to be signed for a while to
+ // hold the special value -1 that is used somewhere
+ // Note that the signed property is also used in loops counting to zero.
+ typedef ptrdiff_t pos_type;
+
+ /*!
+ * A type for paragraph offsets.
+ * This is used to address paragraphs in ParagraphList, Text etc.
+ */
+ // FIXME: should be unsigned as well.
+ // however, simply changing it breaks a downward loop somewhere...
+ typedef ptrdiff_t pit_type;