lyxtext-3-a.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6804 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-04-14 17:57:40 +00:00
parent 3694058883
commit 2da34093a2
2 changed files with 22 additions and 16 deletions

View File

@ -1,3 +1,7 @@
2003-04-14 Lars Gullik Bjønnes <larsbj@gullik.net>
* text3.C (gotoNextInset): use separate tmp vars for par and pos.
2003-04-14 Angus Leeming <leeming@lyx.org>
* LColor.[Ch]: scrap LColor mathcursor.

View File

@ -43,6 +43,7 @@
using std::endl;
using std::find;
using std::vector;
using lyx::pos_type;
extern string current_layout;
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
@ -170,28 +171,29 @@ Inset * LyXText::checkInsetHit(int & x, int & y)
bool LyXText::gotoNextInset(vector<Inset::Code> const & codes,
string const & contents)
{
LyXCursor res = cursor;
ParagraphList::iterator end = ownerParagraphs().end();
ParagraphList::iterator pit = cursor.par();
pos_type pos = cursor.pos();
Inset * inset;
do {
if (res.pos() < res.par()->size() - 1) {
res.pos(res.pos() + 1);
if (pos + 1 < pit->size()) {
++pos;
} else {
res.par(boost::next(res.par()));
res.pos(0);
++pit;
pos = 0;
}
} while (res.par() != ownerParagraphs().end()&&
!(res.par()->isInset(res.pos())
&& (inset = res.par()->getInset(res.pos())) != 0
&& find(codes.begin(), codes.end(), inset->lyxCode())
!= codes.end()
&& (contents.empty() ||
static_cast<InsetCommand *>(
res.par()->getInset(res.pos()))->getContents()
== contents)));
} while (pit != end &&
!(pit->isInset(pos) &&
(inset = pit->getInset(pos)) != 0 &&
find(codes.begin(), codes.end(), inset->lyxCode()) != codes.end() &&
(contents.empty() ||
static_cast<InsetCommand *>(pit->getInset(pos))->getContents()
== contents)));
if (res.par() != ownerParagraphs().end()) {
setCursor(res.par(), res.pos(), false);
if (pit != end) {
setCursor(pit, pos, false);
return true;
}
return false;