From: Jean-Marc Lasgouttes Date: Mon, 30 Jun 2008 12:45:27 +0000 (+0000) Subject: one more step towards good word-level movement: let paragraph breaks be word boundaries X-Git-Tag: 1.6.10~4261 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0bc9149edaf07c0d21a3fd6e9f3aab1db1880a42;p=features.git one more step towards good word-level movement: let paragraph breaks be word boundaries git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25405 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Text.cpp b/src/Text.cpp index 033cbe8aa9..b655830651 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -589,6 +589,10 @@ bool Text::cursorForwardOneWord(Cursor & cur) pos_type pos = cur.pos(); Paragraph const & par = cur.paragraph(); + // Paragraph boundary is a word boundary + if (pos == lastpos && pit != cur.lastpit()) + return setCursor(cur, pit + 1, 0); + // Skip over either a non-char inset or a full word if (pos != lastpos && !par.isLetter(pos) && !par.isChar(pos)) ++pos; @@ -599,11 +603,6 @@ bool Text::cursorForwardOneWord(Cursor & cur) while (pos != lastpos && par.isChar(pos)) ++pos; - if (pos == lastpos && pit != cur.lastpit()) { - ++pit; - pos = 0; - } - return setCursor(cur, pit, pos); } @@ -616,6 +615,10 @@ bool Text::cursorBackwardOneWord(Cursor & cur) pos_type pos = cur.pos(); Paragraph & par = cur.paragraph(); + // Paragraph boundary is a word boundary + if (pos == 0 && pit != 0) + return setCursor(cur, pit - 1, getPar(pit - 1).size()); + // Skip through puctuation and spaces. while (pos != 0 && par.isChar(pos - 1)) --pos; @@ -626,11 +629,6 @@ bool Text::cursorBackwardOneWord(Cursor & cur) else while (pos != 0 && par.isLetter(pos - 1)) --pos; - if (pos == 0 && pit != 0) { - --pit; - pos = getPar(cur.pit() - 1).size(); - } - return setCursor(cur, pit, pos); }