* slice numbers are of type size_t, but here we have to allow -1. idx_type

in any case does not make sense. It's not an index in the sense of DocIterator.
* cosmetics


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22908 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-02-09 22:05:24 +00:00
parent d78b0692e2
commit 036f97a02e
4 changed files with 12 additions and 12 deletions

View File

@ -1496,13 +1496,13 @@ bool notifyCursorLeaves(DocIterator const & old, Cursor & cur)
// find inset in common
size_type i;
for (i = 0; i < old.depth() && i < cur.depth(); ++i) {
if (&old.inset() != &cur.inset())
if (&old[i].inset() != &cur[i].inset())
break;
}
// notify everything on top of the common part in old cursor,
// but stop if the inset claims the cursor to be invalid now
for (; i < old.depth(); ++i) {
for (; i < old.depth(); ++i) {
if (old[i].inset().notifyCursorLeaves(cur))
return true;
}

View File

@ -371,7 +371,7 @@ public:
/**
* Notifies all insets which appear in old, but not in cur. Make
* Sure that the cursor old is valid, i.e. als inset pointer
* Sure that the cursor old is valid, i.e. all inset pointers
* point to valid insets! Use Cursor::fixIfBroken if necessary.
*/
bool notifyCursorLeaves(DocIterator const & old, Cursor & cur);

View File

@ -479,7 +479,7 @@ bool DocIterator::fixIfBroken()
}
DocIterator::idx_type DocIterator::find(MathData const & cell) const
int DocIterator::find(MathData const & cell) const
{
for (size_t l = 0; l != slices_.size(); ++l) {
if (slices_[l].asInsetMath() && &slices_[l].cell() == &cell)
@ -489,7 +489,7 @@ DocIterator::idx_type DocIterator::find(MathData const & cell) const
}
DocIterator::idx_type DocIterator::find(InsetMath const * inset) const
int DocIterator::find(InsetMath const * inset) const
{
for (size_t l = 0; l != slices_.size(); ++l) {
if (slices_[l].asInsetMath() == inset)
@ -499,14 +499,14 @@ DocIterator::idx_type DocIterator::find(InsetMath const * inset) const
}
void DocIterator::cutOff(DocIterator::idx_type above, vector<CursorSlice> & cut)
void DocIterator::cutOff(int above, vector<CursorSlice> & cut)
{
cut = vector<CursorSlice>(slices_.begin() + above + 1, slices_.end());
slices_.resize(above + 1);
}
void DocIterator::cutOff(DocIterator::idx_type above)
void DocIterator::cutOff(int above)
{
slices_.resize(above + 1);
}

View File

@ -212,13 +212,13 @@ public:
bool fixIfBroken();
/// find index of CursorSlice with &cell() == &cell (or -1 if not found)
idx_type find(MathData const & cell) const;
int find(MathData const & cell) const;
/// find index of CursorSlice with inset() == inset (or -1 of not found)
idx_type find(InsetMath const * inset) const;
/// cut off CursorSlices with index > above and store cut off slices in cut
void cutOff(idx_type above, std::vector<CursorSlice> & cut);
int find(InsetMath const * inset) const;
/// cut off CursorSlices with index > above and store cut off slices in cut.
void cutOff(int above, std::vector<CursorSlice> & cut);
/// cut off CursorSlices with index > above
void cutOff(idx_type above);
void cutOff(int above);
/// push CursorSlices on top
void append(std::vector<CursorSlice> const & x);
/// push one CursorSlice on top and set its index and position