Here is the patch fixing Helge's unfinished macro up/down bug, as well as 
making the 
cursor move properly for HOME/END. Also a slight simplification/dead code 
removal.

Unfortunately I didn't get Page Up/Down to behave, so I left that part out.

OK to commit? Works for me.

- Martin

Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.488
diff -u -r1.488 ChangeLog
--- ChangeLog   7 Apr 2005 09:06:08 -0000       1.488
+++ ChangeLog   7 Apr 2005 12:51:59 -0000
@@ -1,5 +1,11 @@
 2005-04-07  Martin Vermeer  <[EMAIL PROTECTED]>
 
+       * math_gridinset.C (doDispatch):
+       * math_nestinset.C (doDispatch): Fix motion of HOME and END keys,
+       and arrow up/down inside macro bug (Helge Hafting report)
+
+2005-04-07  Martin Vermeer  <[EMAIL PROTECTED]>
+
        * math_gridinset.C (getStatus): allow C-Tab to split cell
 
 2005-04-06  Martin Vermeer  <[EMAIL PROTECTED]>
Index: math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.149
diff -u -r1.149 math_nestinset.C
--- math_nestinset.C    6 Apr 2005 19:01:55 -0000       1.149
+++ math_nestinset.C    7 Apr 2005 12:51:59 -0000
@@ -470,11 +470,8 @@
                if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) 
{
                        cur.pushLeft(*cur.nextAtom().nucleus());
                        cur.inset().idxFirst(cur);
-               } else if (cur.posRight() || idxRight(cur)
-                       || cur.popRight() || cur.selection())
+               } else if (cur.posRight() || idxRight(cur) || cur.popRight())
                        ;
-               else
-                       cmd = FuncRequest(LFUN_FINISHED_RIGHT);
                break;
 
        case LFUN_LEFTSEL:
@@ -487,15 +484,18 @@
                        cur.posLeft();
                        cur.push(*cur.nextAtom().nucleus());
                        cur.inset().idxLast(cur);
-               } else if (cur.posLeft() || idxLeft(cur)
-                       || cur.popLeft() || cur.selection())
+               } else if (cur.posLeft() || idxLeft(cur) || cur.popLeft())
                        ;
-               else
-                       cmd = FuncRequest(LFUN_FINISHED_LEFT);
                break;
 
        case LFUN_UPSEL:
        case LFUN_UP:
+               // FIXME Tried to use clearTargetX and macroModeClose, crashed 
on cur.up()
+               if (cur.inMacroMode()) {
+                       // Make Helge happy
+                       cur.macroModeClose();
+                       break;
+               }
                cur.selHandle(cmd.action == LFUN_UPSEL);
                if (!cur.up())
                        cmd = FuncRequest(LFUN_FINISHED_UP);
@@ -505,6 +505,10 @@
 
        case LFUN_DOWNSEL:
        case LFUN_DOWN:
+               if (cur.inMacroMode()) {
+                       cur.macroModeClose();
+                       break;
+               }
                cur.selHandle(cmd.action == LFUN_DOWNSEL);
                if (!cur.down())
                        cmd = FuncRequest(LFUN_FINISHED_DOWN);
@@ -544,7 +548,8 @@
                        cur.idx() = 0;
                        cur.pos() = 0;
                } else {
-                       cmd = FuncRequest(LFUN_FINISHED_LEFT);
+                       cur.popLeft();
+                       cur.pos() = 0;
                }
                break;
 
@@ -564,7 +569,8 @@
                        cur.idx() = cur.lastidx();
                        cur.pos() = cur.lastpos();
                } else {
-                       cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+                       cur.popRight();
+                       cur.pos() = cur.lastpos();
                }
                break;
 
Index: math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.159
diff -u -r1.159 math_gridinset.C
--- math_gridinset.C    7 Apr 2005 09:06:08 -0000       1.159
+++ math_gridinset.C    7 Apr 2005 12:51:59 -0000
@@ -1209,7 +1209,8 @@
                        cur.idx() = 0;
                        cur.pos() = 0;
                } else {
-                       cmd = FuncRequest(LFUN_FINISHED_LEFT);
+                       cur.popLeft();
+                       cur.pos() = 0;
                }
                break;
 
@@ -1229,7 +1230,8 @@
                        cur.idx() = cur.lastidx();
                        cur.pos() = cur.lastpos();
                } else {
-                       cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+                       cur.popRight();
+                       cur.pos() = cur.lastpos();
                }
                break;
 

Attachment: pgppwpZQ7JGWt.pgp
Description: PGP signature

Reply via email to