mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
fix LyXText::getWord (bug 1609)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8828 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
228ecfce96
commit
dc5326c28f
@ -1,3 +1,11 @@
|
||||
2004-06-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* paragraph.C (isWord): return true on insets that report
|
||||
isLetter().
|
||||
|
||||
* text.C (getWord): use Paragraph::isWord to decide what is in a
|
||||
word and what is not; fix bug 1609.
|
||||
|
||||
2004-06-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* tex-strings.C: add "none" to string_paperpackages[], fixes
|
||||
|
@ -1524,7 +1524,9 @@ bool Paragraph::isLetter(pos_type pos) const
|
||||
|
||||
bool Paragraph::isWord(pos_type pos) const
|
||||
{
|
||||
unsigned char const c = getChar(pos);
|
||||
if (isInset(pos))
|
||||
return getInset(pos)->isLetter();
|
||||
value_type const c = getChar(pos);
|
||||
return !(IsSeparatorChar(c)
|
||||
|| IsKommaChar(c)
|
||||
|| IsInsetChar(c));
|
||||
|
32
src/text.C
32
src/text.C
@ -1842,46 +1842,36 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
||||
switch (loc) {
|
||||
case lyx::WHOLE_WORD_STRICT:
|
||||
if (from.pos() == 0 || from.pos() == from_par.size()
|
||||
|| from_par.isSeparator(from.pos())
|
||||
|| from_par.isKomma(from.pos())
|
||||
|| from_par.isNewline(from.pos())
|
||||
|| from_par.isSeparator(from.pos() - 1)
|
||||
|| from_par.isKomma(from.pos() - 1)
|
||||
|| from_par.isNewline(from.pos() - 1)) {
|
||||
|| !from_par.isWord(from.pos())
|
||||
|| !from_par.isWord(from.pos() - 1)) {
|
||||
to = from;
|
||||
return;
|
||||
}
|
||||
// no break here, we go to the next
|
||||
|
||||
case lyx::WHOLE_WORD:
|
||||
// Move cursor to the beginning, when not already there.
|
||||
if (from.pos() && !from_par.isSeparator(from.pos() - 1)
|
||||
&& !(from_par.isKomma(from.pos() - 1)
|
||||
|| from_par.isNewline(from.pos() - 1)))
|
||||
cursorLeftOneWord(bv()->cursor());
|
||||
break;
|
||||
// If we are already at the beginning of a word, do nothing
|
||||
if (!from.pos() || !from_par.isWord(from.pos() - 1))
|
||||
break;
|
||||
// no break here, we go to the next
|
||||
|
||||
case lyx::PREVIOUS_WORD:
|
||||
// always move the cursor to the beginning of previous word
|
||||
cursorLeftOneWord(bv()->cursor());
|
||||
while (from.pos() && from_par.isWord(from.pos() - 1))
|
||||
--from.pos();
|
||||
break;
|
||||
case lyx::NEXT_WORD:
|
||||
lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet"
|
||||
<< endl;
|
||||
break;
|
||||
case lyx::PARTIAL_WORD:
|
||||
// no need to move the 'from' cursor
|
||||
break;
|
||||
}
|
||||
to = from;
|
||||
Paragraph & to_par = pars_[to.par()];
|
||||
while (to.pos() < to_par.size()
|
||||
&& !to_par.isSeparator(to.pos())
|
||||
&& !to_par.isKomma(to.pos())
|
||||
&& !to_par.isNewline(to.pos())
|
||||
&& !to_par.isHfill(to.pos())
|
||||
&& !to_par.isInset(to.pos()))
|
||||
{
|
||||
while (to.pos() < to_par.size() && to_par.isWord(to.pos()))
|
||||
++to.pos();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user