mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
handle insetlatexaccent, hyphenation point and ligature breaks as part of a word
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9252 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a2891b5255
commit
56c4672858
@ -1,3 +1,10 @@
|
||||
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* text.C (cursorLeftOneWord):
|
||||
(getWord): simplify by using Paragraph::isWord
|
||||
|
||||
* paragraph.C (isWord): invoke Inset::isLetter on insets
|
||||
|
||||
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* paragraph.C (TeXOnePar): use LyXStyle::needprotect and pass it
|
||||
|
@ -1,3 +1,7 @@
|
||||
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* insetlatexaccent.h (isLetter): implement
|
||||
|
||||
2004-11-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* insetoptarg.C (latexOptional): honor 'fragile' argument (bug 1739)
|
||||
|
@ -76,6 +76,8 @@ public:
|
||||
inline bool canDisplay();
|
||||
// should this inset be handled like a normal charater
|
||||
bool isChar() const { return true; }
|
||||
/// is this equivalent to a letter?
|
||||
bool isLetter() const { return candisp; }
|
||||
|
||||
/// all the accent types
|
||||
enum ACCENT_TYPES{
|
||||
|
@ -1681,7 +1681,10 @@ bool Paragraph::isLetter(pos_type pos) const
|
||||
|
||||
bool Paragraph::isWord(pos_type pos) const
|
||||
{
|
||||
return IsWordChar(getChar(pos)) ;
|
||||
if (isInset(pos))
|
||||
return getInset(pos)->isLetter();
|
||||
else
|
||||
return IsWordChar(getChar(pos)) ;
|
||||
}
|
||||
|
||||
|
||||
|
45
src/text.C
45
src/text.C
@ -2287,25 +2287,16 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const
|
||||
{
|
||||
// treat HFills, floats and Insets as words
|
||||
cur = cursor;
|
||||
while (cur.pos()
|
||||
&& (cur.par()->isSeparator(cur.pos() - 1)
|
||||
|| cur.par()->isKomma(cur.pos() - 1))
|
||||
&& !(cur.par()->isHfill(cur.pos() - 1)
|
||||
|| cur.par()->isInset(cur.pos() - 1)))
|
||||
while (cur.pos() && !cur.par()->isWord(cur.pos() - 1))
|
||||
cur.pos(cur.pos() - 1);
|
||||
|
||||
if (cur.pos()
|
||||
&& (cur.par()->isInset(cur.pos() - 1)
|
||||
|| cur.par()->isHfill(cur.pos() - 1))) {
|
||||
cur.pos(cur.pos() - 1);
|
||||
} else if (!cur.pos()) {
|
||||
if (!cur.pos()) {
|
||||
if (cur.par()->previous()) {
|
||||
cur.par(cur.par()->previous());
|
||||
cur.pos(cur.par()->size());
|
||||
}
|
||||
} else { // Here, cur != 0
|
||||
while (cur.pos() > 0 &&
|
||||
cur.par()->isWord(cur.pos() - 1))
|
||||
while (cur.pos() > 0 && cur.par()->isWord(cur.pos() - 1))
|
||||
cur.pos(cur.pos() - 1);
|
||||
}
|
||||
}
|
||||
@ -2316,45 +2307,39 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const
|
||||
void LyXText::getWord(LyXCursor & from, LyXCursor & to,
|
||||
word_location const loc) const
|
||||
{
|
||||
// first put the cursor where we wana start to select the word
|
||||
// first put the cursor where we wanna start to select the word
|
||||
from = cursor;
|
||||
switch (loc) {
|
||||
case WHOLE_WORD_STRICT:
|
||||
if (cursor.pos() == 0 || cursor.pos() == cursor.par()->size()
|
||||
|| cursor.par()->isSeparator(cursor.pos())
|
||||
|| cursor.par()->isKomma(cursor.pos())
|
||||
|| cursor.par()->isSeparator(cursor.pos() - 1)
|
||||
|| cursor.par()->isKomma(cursor.pos() - 1)) {
|
||||
|| !cursor.par()->isWord(cursor.pos())
|
||||
|| !cursor.par()->isWord(cursor.pos() - 1)) {
|
||||
to = from;
|
||||
return;
|
||||
}
|
||||
// no break here, we go to the next
|
||||
|
||||
case 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))
|
||||
cursorLeftOneWord(from);
|
||||
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 PREVIOUS_WORD:
|
||||
// always move the cursor to the beginning of previous word
|
||||
cursorLeftOneWord(from);
|
||||
while (from.pos() && from.par()->isWord(from.pos() - 1))
|
||||
from.pos(from.pos() - 1);
|
||||
break;
|
||||
case NEXT_WORD:
|
||||
lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet\n";
|
||||
break;
|
||||
case PARTIAL_WORD:
|
||||
// no need to move the 'from' cursor
|
||||
break;
|
||||
}
|
||||
to = from;
|
||||
while (to.pos() < to.par()->size()
|
||||
&& !to.par()->isSeparator(to.pos())
|
||||
&& !to.par()->isKomma(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(to.pos() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,13 @@ What's new
|
||||
Ctrl-PageDown and Control-PageUp (except with mac bindings, where
|
||||
<cmd>-tab and <cmd>-backtab are used) [bugs 515 and 1639].
|
||||
|
||||
- LaTeX-type accents (which are used when converting from 7bit latex
|
||||
documents or when a given accented letter does not exist in the
|
||||
document encoding) are now considered as part of words; the same
|
||||
holds for ligature breaks and hyphenation marks. This impacts word
|
||||
level operation like selection by double-click or index entry
|
||||
defaults.
|
||||
|
||||
|
||||
** Bug fixes
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user