- if (old.pos() == 0 && old.pit() != 0) {
- --old.pit();
- old.pos() = old.lastpos();
- } else {
- // Skip through initial nonword stuff.
- while (old.pos() != 0 && !old.paragraph().isLetter(old.pos() - 1))
- --old.pos();
- // Advance through word.
- while (old.pos() != 0 && old.paragraph().isLetter(old.pos() - 1))
- --old.pos();
+ // Skip through puctuation and spaces.
+ while (pos != 0 && par.isChar(pos - 1))
+ --pos;
+
+ // Skip over either a non-char inset or a full word
+ if (pos != 0 && !par.isLetter(pos) && !par.isChar(pos - 1))
+ --pos;
+ else while (pos != 0 && par.isLetter(pos - 1))
+ --pos;
+
+ if (pos == 0 && pit != 0) {
+ --pit;
+ pos = getPar(cur.pit() - 1).size();