All that below of course should be a better way to implement cursorUp/ Down in display math (after removing the mentioned magic margin in Text::cursorUp/Down which was needed according to Martin for display math).

Stefan

I am not completely sure how to do this in the right way, but what we need something like this:

Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp      (Revision 18436)
+++ src/Cursor.cpp      (Arbeitskopie)
@@ -1101,10 +1101,18 @@
                // no such inset found, just take something "above"
                if (!popLeft()) {
+                       // ask text to move cursor
+                       if (up)
+ const_cast<Text *>(text())->cursorUp (*this);
+                       else
+ const_cast<Text *>(text())- >cursorDown(*this);
+                       return true;
+/*
//lyxerr << "updown: popleft failed (strange case)" << endl;
                        int ylow  = up ? 0 : yo + 1;
                        int yhigh = up ? yo - 1 : bv().workHeight();
return bruteFind(*this, xo, yo, 0, bv ().workWidth(), ylow, yhigh);
+                       */
                }
                // any improvement so far?


The idea is that the cursor tried to query all the inset on the path to move the cursor up/down. If none can do that (i.e. popLeft () == false), a bruteFind was done. Instead the cursorUp/Down of the text must be called to move into the next/previous paragraph. Of course the const_cast is not clean here. How can we do this in a cleaner way?

With this code the x_target_ is changed to the position of the display math. I think it's more natural to keep the x_target of the text paragraph instead. For that in Text::cursorUp/Down another test would be needed to test if the next paragraph is a display math. How do I do that?

Stefan

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to