mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +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>
|
2004-06-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* tex-strings.C: add "none" to string_paperpackages[], fixes
|
* 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
|
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)
|
return !(IsSeparatorChar(c)
|
||||||
|| IsKommaChar(c)
|
|| IsKommaChar(c)
|
||||||
|| IsInsetChar(c));
|
|| IsInsetChar(c));
|
||||||
|
32
src/text.C
32
src/text.C
@ -1842,46 +1842,36 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
|||||||
switch (loc) {
|
switch (loc) {
|
||||||
case lyx::WHOLE_WORD_STRICT:
|
case lyx::WHOLE_WORD_STRICT:
|
||||||
if (from.pos() == 0 || from.pos() == from_par.size()
|
if (from.pos() == 0 || from.pos() == from_par.size()
|
||||||
|| from_par.isSeparator(from.pos())
|
|| !from_par.isWord(from.pos())
|
||||||
|| from_par.isKomma(from.pos())
|
|| !from_par.isWord(from.pos() - 1)) {
|
||||||
|| from_par.isNewline(from.pos())
|
|
||||||
|| from_par.isSeparator(from.pos() - 1)
|
|
||||||
|| from_par.isKomma(from.pos() - 1)
|
|
||||||
|| from_par.isNewline(from.pos() - 1)) {
|
|
||||||
to = from;
|
to = from;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// no break here, we go to the next
|
// no break here, we go to the next
|
||||||
|
|
||||||
case lyx::WHOLE_WORD:
|
case lyx::WHOLE_WORD:
|
||||||
// Move cursor to the beginning, when not already there.
|
// If we are already at the beginning of a word, do nothing
|
||||||
if (from.pos() && !from_par.isSeparator(from.pos() - 1)
|
if (!from.pos() || !from_par.isWord(from.pos() - 1))
|
||||||
&& !(from_par.isKomma(from.pos() - 1)
|
break;
|
||||||
|| from_par.isNewline(from.pos() - 1)))
|
// no break here, we go to the next
|
||||||
cursorLeftOneWord(bv()->cursor());
|
|
||||||
break;
|
|
||||||
case lyx::PREVIOUS_WORD:
|
case lyx::PREVIOUS_WORD:
|
||||||
// always move the cursor to the beginning of 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;
|
break;
|
||||||
case lyx::NEXT_WORD:
|
case lyx::NEXT_WORD:
|
||||||
lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet"
|
lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet"
|
||||||
<< endl;
|
<< endl;
|
||||||
break;
|
break;
|
||||||
case lyx::PARTIAL_WORD:
|
case lyx::PARTIAL_WORD:
|
||||||
|
// no need to move the 'from' cursor
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
to = from;
|
to = from;
|
||||||
Paragraph & to_par = pars_[to.par()];
|
Paragraph & to_par = pars_[to.par()];
|
||||||
while (to.pos() < to_par.size()
|
while (to.pos() < to_par.size() && to_par.isWord(to.pos()))
|
||||||
&& !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()))
|
|
||||||
{
|
|
||||||
++to.pos();
|
++to.pos();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user