From 82263ccad98dba35f1f4527a8ed72ea24a60e0bd Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 19 Mar 2015 21:44:25 +0100 Subject: [PATCH] Implement DocIterator::backwardInset() I thought I would need it to fix bug #9418, but once backwardInset() worked it turned out that it is not needed. However, since it took me some time to figure out the correct implementation I do not want to throw the result away. --- src/DocIterator.cpp | 22 ++++++++++++++++++++++ src/DocIterator.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index e574115c31..750479f8d4 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -449,6 +449,28 @@ void DocIterator::backwardPos() } +#if 0 +// works, but currently not needed +void DocIterator::backwardInset() +{ + backwardPos(); + + while (!empty() && !nextInset()) { + if (inTexted()) { + pos_type const lastp = lastpos(); + Paragraph const & par = paragraph(); + pos_type & pos = top().pos(); + while (pos > 0 && (pos == lastp || !par.isInset(pos))) + --pos; + if (pos > 0) + break; + } + backwardPos(); + } +} +#endif + + bool DocIterator::hasPart(DocIterator const & it) const { // it can't be a part if it is larger diff --git a/src/DocIterator.h b/src/DocIterator.h index 77968191dd..6a86e41d44 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -202,7 +202,7 @@ public: /// move backward one paragraph void backwardPar(); /// move backward one inset - /// FIXME: This is not implemented! + /// not used currently, uncomment if you need it //void backwardInset(); /// are we some 'extension' (i.e. deeper nested) of the given iterator