lfun word-select

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5265 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-09-11 14:48:19 +00:00
parent a37064c0ac
commit 4e672b30f3
8 changed files with 36 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2002-09-11 André Pönitz <poenitz@gmx.net>
* commandtags.h:
* LyXAction.C:
* text3.C: implement LFUN_WORDSEL
2002-09-11 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyxtextclass.h: don't include FloatList.h, forward declare instead.

View File

@ -398,6 +398,7 @@ void LyXAction::init()
{ LFUN_WORDRIGHT, "word-forward", "", ReadOnly },
{ LFUN_WORDRIGHTSEL, "word-forward-select", "", ReadOnly },
{ LFUN_LOWCASE_WORD, "word-lowcase", "", Noop },
{ LFUN_WORDSEL, "word-select", "", ReadOnly },
{ LFUN_UPCASE_WORD, "word-upcase", "", Noop },
{ LFUN_MESSAGE, "message",
N_("Show message in minibuffer"), NoBuffer },

View File

@ -82,6 +82,7 @@ enum kb_action {
LFUN_ENDSEL, // 60
LFUN_WORDRIGHTSEL,
LFUN_WORDLEFTSEL,
LFUN_WORDSEL,
LFUN_BEGINNINGBUFSEL,
LFUN_ENDBUFSEL,
LFUN_PROTECTEDSPACE,

View File

@ -1,3 +1,8 @@
2002-09-11 André Pönitz <poenitz@gmx.net>
* insettabular.C: implement LFUN_WORDSEL
2002-09-10 John Levon <levon@movementarian.org>
* insetinclude.h: remove unused param

View File

@ -1126,6 +1126,7 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
case LFUN_WORDLEFTSEL:
case LFUN_WORDRIGHT:
case LFUN_WORDRIGHTSEL:
case LFUN_WORDSEL:
case LFUN_DOWN_PARAGRAPH:
case LFUN_DOWN_PARAGRAPHSEL:
case LFUN_UP_PARAGRAPH:

View File

@ -463,6 +463,12 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
updateLocal(bv, false);
break;
case LFUN_WORDSEL:
mathcursor->home(false);
mathcursor->end(true);
updateLocal(bv, false);
break;
case LFUN_HOMESEL:
sel = true; // fall through
case LFUN_HOME:

View File

@ -2284,7 +2284,7 @@ void LyXText::cursorLeftOneWord(BufferView * bview) const
}
void LyXText::cursorLeftOneWord(LyXCursor & cur) const
void LyXText::cursorLeftOneWord(LyXCursor & cur) const
{
// treat HFills, floats and Insets as words
cur = cursor;
@ -2306,7 +2306,7 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const
}
} else { // Here, cur != 0
while (cur.pos() > 0 &&
cur.par()->isWord(cur.pos()-1))
cur.par()->isWord(cur.pos() - 1))
cur.pos(cur.pos() - 1);
}
}
@ -2324,8 +2324,8 @@ void LyXText::getWord(LyXCursor & from, LyXCursor & to,
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()->isSeparator(cursor.pos() - 1)
|| cursor.par()->isKomma(cursor.pos() - 1)) {
to = from;
return;
}

View File

@ -553,6 +553,18 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
finishChange(bv, true);
break;
case LFUN_WORDSEL: {
update(bv, false);
LyXCursor cur1;
LyXCursor cur2;
getWord(cur1, cur2, WHOLE_WORD);
setCursor(bv, cur1.par(), cur1.pos());
bv->beforeChange(this);
setCursor(bv, cur2.par(), cur2.pos());
finishChange(bv, true);
break;
}
case LFUN_RIGHT: {
bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
if (!selection.mark())