On Wed, May 30, 2007 at 11:12:32PM +0300, Dov Feldstern wrote: > Index: lyx-devel/src/Text2.cpp > =================================================================== > --- lyx-devel.orig/src/Text2.cpp 2007-05-30 22:49:48.000000000 +0300 > +++ lyx-devel/src/Text2.cpp 2007-05-30 22:58:42.000000000 +0300 > @@ -1002,9 +1002,9 @@ > #endif > if (!cur.boundary() && > cur.textRow().pos() == cur.pos() && > - !cur.paragraph().isLineSeparator(cur.pos() - 1) > && > - !cur.paragraph().isNewline(cur.pos() - 1) && > - !cur.paragraph().isSeparator(cur.pos() - 1)) { > + cur.paragraph().isLineSeparator(cur.pos() - 1) > && > + cur.paragraph().isNewline(cur.pos() - 1) && > + cur.paragraph().isSeparator(cur.pos() - 1)) { > return setCursor(cur, cur.pit(), cur.pos(), true, true); > } > > @@ -1059,9 +1059,9 @@ > #endif > if (cur.textRow().endpos() == cur.pos() + 1 && > cur.textRow().endpos() != cur.lastpos() && > - !cur.paragraph().isNewline(cur.pos()) && > - !cur.paragraph().isLineSeparator(cur.pos()) && > - !cur.paragraph().isSeparator(cur.pos())) { > + cur.paragraph().isNewline(cur.pos() + 1) && > + cur.paragraph().isLineSeparator(cur.pos() + 1) > && > + cur.paragraph().isSeparator(cur.pos() + 1)) { > return setCursor(cur, cur.pit(), cur.pos() + 1, true, > true); > } >
Maybe we could have the test in a separate function returning a bool. I am also uncertain whether cur.paragraph().isNewline(cur.pos() + 1) && cur.paragraph().isLineSeparator(cur.pos() + 1) && cur.paragraph().isSeparator(cur.pos() + 1)) makes much sense. bool Paragraph::isNewline(pos_type pos) const { return isInset(pos) && getInset(pos)->lyxCode() == Inset::NEWLINE_CODE; } bool Paragraph::isLineSeparator(pos_type pos) const { value_type const c = getChar(pos); return isLineSeparatorChar(c) || (c == Paragraph::META_INSET && getInset(pos) && getInset(pos)->isLineSeparator()); } The first seems only true for InsetNewline, the second for InsetSpecialChar... Andre'