mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
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
This commit is contained in:
parent
d3bf7155b8
commit
0bc9149eda
18
src/Text.cpp
18
src/Text.cpp
@ -589,6 +589,10 @@ bool Text::cursorForwardOneWord(Cursor & cur)
|
|||||||
pos_type pos = cur.pos();
|
pos_type pos = cur.pos();
|
||||||
Paragraph const & par = cur.paragraph();
|
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
|
// Skip over either a non-char inset or a full word
|
||||||
if (pos != lastpos && !par.isLetter(pos) && !par.isChar(pos))
|
if (pos != lastpos && !par.isLetter(pos) && !par.isChar(pos))
|
||||||
++pos;
|
++pos;
|
||||||
@ -599,11 +603,6 @@ bool Text::cursorForwardOneWord(Cursor & cur)
|
|||||||
while (pos != lastpos && par.isChar(pos))
|
while (pos != lastpos && par.isChar(pos))
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
if (pos == lastpos && pit != cur.lastpit()) {
|
|
||||||
++pit;
|
|
||||||
pos = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return setCursor(cur, pit, pos);
|
return setCursor(cur, pit, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,6 +615,10 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
|
|||||||
pos_type pos = cur.pos();
|
pos_type pos = cur.pos();
|
||||||
Paragraph & par = cur.paragraph();
|
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.
|
// Skip through puctuation and spaces.
|
||||||
while (pos != 0 && par.isChar(pos - 1))
|
while (pos != 0 && par.isChar(pos - 1))
|
||||||
--pos;
|
--pos;
|
||||||
@ -626,11 +629,6 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
|
|||||||
else while (pos != 0 && par.isLetter(pos - 1))
|
else while (pos != 0 && par.isLetter(pos - 1))
|
||||||
--pos;
|
--pos;
|
||||||
|
|
||||||
if (pos == 0 && pit != 0) {
|
|
||||||
--pit;
|
|
||||||
pos = getPar(cur.pit() - 1).size();
|
|
||||||
}
|
|
||||||
|
|
||||||
return setCursor(cur, pit, pos);
|
return setCursor(cur, pit, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user