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> 2003-04-14 Angus Leeming <leeming@lyx.org>
* LColor.[Ch]: scrap LColor mathcursor. * LColor.[Ch]: scrap LColor mathcursor.

View File

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