mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
fix two lfuns
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8341 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
25bafa2772
commit
bc596c4af7
@ -1,3 +1,7 @@
|
||||
2004-01-14 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* text.C (getWord): fix getWord (and thus LFUN_WORDSEL)
|
||||
* text3.C (dispatch): fix LFUN_WORD{RIGHT,LEFT}SEL
|
||||
|
||||
2004-01-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -178,7 +178,11 @@ public:
|
||||
lyx::pos_type getColumnNearX(ParagraphList::iterator pit,
|
||||
Row const & row, int & x, bool & boundary) const;
|
||||
|
||||
/// select the word we need depending on word_location
|
||||
/** Find the word under \c from in the relative location
|
||||
* defined by \c word_location.
|
||||
* @param from return here the start of the word
|
||||
* @param to return here the end of the word
|
||||
*/
|
||||
void getWord(CursorSlice & from, CursorSlice & to, lyx::word_location const);
|
||||
/// just selects the word the cursor is in
|
||||
void selectWord(lyx::word_location loc);
|
||||
|
@ -1710,7 +1710,6 @@ void LyXText::cursorRightOneWord(CursorSlice & cur)
|
||||
void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const loc)
|
||||
{
|
||||
ParagraphList::iterator from_par = getPar(from);
|
||||
ParagraphList::iterator to_par = getPar(to);
|
||||
switch (loc) {
|
||||
case lyx::WHOLE_WORD_STRICT:
|
||||
if (from.pos() == 0 || from.pos() == from_par->size()
|
||||
@ -1744,6 +1743,7 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const
|
||||
break;
|
||||
}
|
||||
to = from;
|
||||
ParagraphList::iterator to_par = getPar(to);
|
||||
while (to.pos() < to_par->size()
|
||||
&& !to_par->isSeparator(to.pos())
|
||||
&& !to_par->isKomma(to.pos())
|
||||
|
@ -1149,8 +1149,7 @@ void LyXText::setCursor(CursorSlice & cur, paroffset_type par,
|
||||
if (paragraphs().begin()->rows.empty())
|
||||
return;
|
||||
|
||||
// get the cursor y position in text
|
||||
|
||||
// now some strict checking
|
||||
ParagraphList::iterator pit = getPar(par);
|
||||
Row const & row = *pit->getRow(pos);
|
||||
pos_type const end = row.endpos();
|
||||
|
11
src/text3.C
11
src/text3.C
@ -618,6 +618,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_WORDRIGHTSEL:
|
||||
if (!selection.set())
|
||||
bv->resetAnchor();
|
||||
if (rtl())
|
||||
cursorLeftOneWord();
|
||||
else
|
||||
@ -626,6 +628,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_WORDLEFTSEL:
|
||||
if (!selection.set())
|
||||
bv->resetAnchor();
|
||||
if (rtl())
|
||||
cursorRightOneWord();
|
||||
else
|
||||
@ -634,12 +638,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_WORDSEL: {
|
||||
CursorSlice cur1 = cursor();
|
||||
CursorSlice cur2;
|
||||
getWord(cur1, cur2, lyx::WHOLE_WORD);
|
||||
setCursor(cur1.par(), cur1.pos());
|
||||
clearSelection();
|
||||
setCursor(cur2.par(), cur2.pos());
|
||||
selectWord(lyx::WHOLE_WORD);
|
||||
finishChange(bv, true);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user