And with this change you can leave mathed with cursor up/down and get the math redrawn for the decorations:

Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp       (Revision 18737)
+++ src/Text3.cpp       (Arbeitskopie)
@@ -512,24 +512,30 @@
                break;

        case LFUN_UP:
-       case LFUN_UP_SELECT: {
-               //lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl;
-               needsUpdate |= cur.selHandle(cmd.action == LFUN_UP_SELECT);
-               bool const successful = cur.upDownInText(true, needsUpdate);
-               if (!successful)
-                       cur.undispatched();
-               if (cur.selection())
-                       saveSelection(cur);
-               break;
-       }
-
+       case LFUN_UP_SELECT:
        case LFUN_DOWN:
        case LFUN_DOWN_SELECT: {
-               //lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl;
-               needsUpdate |= cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
-               bool const successful = cur.upDownInText(false, needsUpdate);
-               if (!successful)
+               // FIXME: what is this doing?
+               bool select = cmd.action == LFUN_DOWN_SELECT ||
+                       cmd.action == LFUN_UP_SELECT;
+               needsUpdate |= cur.selHandle(select);
+               
+               // move cursor up/down
+               bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP;
+               bool const successful = cur.upDownInText(up, needsUpdate);
+               if (successful) {
+                       // notify insets which were left and get their update 
flags
+                       cur.updateFlags(Update::None);
+                       notifyCursorLeaves(cur.beforeDispatchCursor(), cur);
+                       cur.fixIfBroken();
+                       needsUpdate |= cur.disp_.update() & Update::Force;
+                       
+                       // redraw if you leave mathed (for the decorations
+                       needsUpdate |= cur.beforeDispatchCursor().inMathed();
+               } else
                        cur.undispatched();
+               
+               // save new selection
                if (cur.selection())
                        saveSelection(cur);
                break;


Stefan

The patch with the change above included:

Attachment: notifycursorleavesupdown.patch
Description: Binary data


Am 12.06.2007 um 10:53 schrieb Abdelrazak Younes:

Stefan Schimanski wrote:
Am 12.06.2007 um 10:22 schrieb Abdelrazak Younes:
Stefan Schimanski wrote:
No, it's not intentional. It's a bug that notifyCursorLeaves is not called. Had noticed that before some time ago. Will look into it.
This whole updateflag business makes me crazy. The MathMacro get's the notifyCursorLeaves call. It then sets the Update::Force flag to trigger a redraw. But of course the MathMacro does not know what should happen on cursorDown from the last cell.

Couldn't it check if the flag is set to Update::Force?
An excerpt from Cursor::dispatch:
  disp_.update(Update::FitCursor | Update::Force);
  disp_.dispatched(true);
  inset().dispatch(*this, cmd);
  if (disp_.dispatched())
      break;

Ah yes I remember... I wanted to inverse the logic but never found the time to do so.

So checking for Update::Force is not possible like that. And setting it to NoUpdate first and then check for Force will break a lot I guess.

Right, too late for 1.5. Still the inverse logic is better IMHO.

So it marks the lfun as undispatched. But then the Update::Force flag is overwritten later by the cursor down handler of the text.

Maybe you could change this overwritting?

As far
as I see there is no way to trigger a complete redraw reliable from anywhere else than the inset which dispatches the lfun.

If the Cursor is passed there is: by checking and accumulating the update flag.
What do you mean? I don't see how to do anything like that.

I mean: if (cur.result().update() == Update::Force) this means that the flag has been explicitely set previously as opposed to have the default value (Update::FitCursor | Update::Force). Maybe this information could be used?

Abdel.


Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to