Leuven, E. a écrit :
> I had to do that in text.C. Cursor inherits DocIterator so
> you can use that. "ParIterator it(cur)" should do the trick.
that's what i did, see attached.
it get's quite ugly though because selections can be set both forward
and backward.
it becomes especially nasty in the case when we are moving pars up
because ParIterator is a forward iterator and i need the paragraph
before the pars we are moving (am now moving the cursors temporarily
backwards).
I need that also in the code I am working on so I have enabled it, see
patch attached. My version of backwardPar does not take all cases and I
am not sure it works either (done it very quickly). This is core lyx
feature so this will need the help of core lyx devels.
suggestions on how to make it nicer are appreciated.
I'll take a look.
Abdel.
Index: dociterator.C
===================================================================
--- dociterator.C (revision 13592)
+++ dociterator.C (working copy)
@@ -445,6 +445,17 @@
}
+// This does not go inside inset that are enlosed within a paragraph.
+void DocIterator::backwardPar()
+{
+ // Go to first pos in paragraph
+ pos() = 0;
+ // Backward one pos -> move into previous inset eventually.
+ backwardPos();
+ // Go to first pos in current new paragraph
+ pos() = 0;
+}
+
void DocIterator::backwardChar()
{
backwardPos();
Index: pariterator.h
===================================================================
--- pariterator.h (revision 13594)
+++ pariterator.h (working copy)
@@ -56,7 +56,7 @@
///
ParIterator operator++(int);
/// See comment in pariterator.C
- //ParIterator & operator--();
+ ParIterator & operator--();
///
Paragraph & operator*() const;
///