With one user.
comments?
Alfredo
Index: iterators.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.C,v
retrieving revision 1.28
diff -u -p -u -r1.28 iterators.C
--- iterators.C 5 Nov 2003 11:17:11 -0000 1.28
+++ iterators.C 6 Nov 2003 08:51:00 -0000
@@ -363,6 +363,31 @@ PosIterator ParIterator::asPosIterator(l
}
+ParIterator::ParIterator(PosIterator const & pos)
+ : pimpl_(new Pimpl)
+{
+ PosIterator copy = pos;
+ int const size = copy.stack_.size();
+
+ for (int i = 0; i < size; ++i) {
+ PosIteratorItem & it = copy.stack_.top();
+ ParPosition pp(it.pit, *it.pl);
+ if (i > 0) {
+ InsetOld * inset = it.pit->getInset(it.pos);
+ BOOST_ASSERT(inset);
+ InsetList::iterator beg = it.pit->insetlist.begin();
+ InsetList::iterator end = it.pit->insetlist.end();
+ for (; beg != end && beg->inset != inset; ++beg);
+ BOOST_ASSERT(beg != end);
+ pp.it.reset(beg);
+ pp.index.reset(it.index - 1);
+ }
+ pimpl_->positions.insert(pimpl_->positions.begin(), pp);
+ copy.stack_.pop();
+ }
+}
+
+
void ParIterator::lockPath(BufferView * bv) const
{
bv->insetUnlock();
Index: iterators.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.h,v
retrieving revision 1.23
diff -u -p -u -r1.23 iterators.h
--- iterators.h 5 Nov 2003 11:17:11 -0000 1.23
+++ iterators.h 6 Nov 2003 08:51:00 -0000
@@ -33,6 +33,8 @@ public:
///
ParIterator(ParIterator const &);
///
+ ParIterator(PosIterator const &);
+ ///
void operator=(ParIterator const &);
///
ParIterator & operator++();
@@ -46,8 +48,7 @@ public:
ParagraphList::iterator pit() const;
///
ParagraphList & plist() const;
- /// returns 'innermost' LyXText if in an inset or '0' instead of
- //bv->text
+ /// returns 'innermost' LyXText
LyXText * text(BufferView *) const;
/// returns innermost inset
InsetOld * inset() const;
Index: bufferview_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v
retrieving revision 1.121
diff -u -p -u -r1.121 bufferview_funcs.C
--- bufferview_funcs.C 5 Nov 2003 11:17:11 -0000 1.121
+++ bufferview_funcs.C 6 Nov 2003 08:51:01 -0000
@@ -428,9 +428,7 @@ void replaceSelection(LyXText * text)
void put_selection_at(BufferView * bv, PosIterator const & cur,
int length, bool backwards)
{
- ParIterator par = bv->buffer()->par_iterator_begin();
- for (; par.pit() != cur.pit(); ++par)
- ;
+ ParIterator par(cur);
bv->getLyXText()->clearSelection();
Index: PosIterator.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/PosIterator.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 PosIterator.h
--- PosIterator.h 4 Nov 2003 08:07:07 -0000 1.3
+++ PosIterator.h 6 Nov 2003 08:51:01 -0000
@@ -52,6 +52,7 @@ public:
lyx::pos_type pos() const { return stack_.top().pos; }
bool at_end() const;
friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const;
+ friend ParIterator::ParIterator(PosIterator const &);
private:
PosIterator() {};