mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 05:40:59 +00:00
Move leaveInset and isInside from CursorData to DocIterator
They only touch the slices of the main DocIterator.
This commit is contained in:
parent
86398b5d91
commit
4727e2becf
@ -571,26 +571,6 @@ void CursorData::sanitize()
|
||||
}
|
||||
|
||||
|
||||
bool CursorData::isInside(Inset const * p) const
|
||||
{
|
||||
for (size_t i = 0; i != depth(); ++i)
|
||||
if (&operator[](i).inset() == p)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CursorData::leaveInset(Inset const & inset)
|
||||
{
|
||||
for (size_t i = 0; i != depth(); ++i) {
|
||||
if (&operator[](i).inset() == &inset) {
|
||||
resize(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CursorData::undoAction()
|
||||
{
|
||||
if (!buffer()->undo().undoAction(*this))
|
||||
|
@ -171,10 +171,6 @@ public:
|
||||
/// Repopulate the slices insets from bottom to top. Useful
|
||||
/// for stable iterators or Undo data.
|
||||
void sanitize();
|
||||
///
|
||||
bool isInside(Inset const *) const;
|
||||
/// make sure we are outside of given inset
|
||||
void leaveInset(Inset const & inset);
|
||||
|
||||
///
|
||||
bool undoAction();
|
||||
|
@ -656,6 +656,26 @@ void DocIterator::sanitize()
|
||||
}
|
||||
|
||||
|
||||
bool DocIterator::isInside(Inset const * p) const
|
||||
{
|
||||
for (CursorSlice const & sl : slices_)
|
||||
if (&sl.inset() == p)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void DocIterator::leaveInset(Inset const & inset)
|
||||
{
|
||||
for (size_t i = 0; i != slices_.size(); ++i) {
|
||||
if (&slices_[i].inset() == &inset) {
|
||||
resize(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int DocIterator::find(MathData const & cell) const
|
||||
{
|
||||
for (size_t l = 0; l != slices_.size(); ++l) {
|
||||
|
@ -249,6 +249,10 @@ public:
|
||||
/// Repopulate the slices insets from bottom to top. Useful
|
||||
/// for stable iterators or Undo data.
|
||||
void sanitize();
|
||||
///
|
||||
bool isInside(Inset const *) const;
|
||||
/// make sure we are outside of given inset
|
||||
void leaveInset(Inset const & inset);
|
||||
|
||||
/// find index of CursorSlice with &cell() == &cell (or -1 if not found)
|
||||
int find(MathData const & cell) const;
|
||||
|
Loading…
Reference in New Issue
Block a user