On Wed, 2005-04-06 at 18:51, Martin Vermeer wrote: > On Wed, 2005-04-06 at 10:15, Martin Vermeer wrote: > > On Tue, Apr 05, 2005 at 11:03:19PM +0200, Helge Hafting wrote: > > > Move into a math inset. > > > Type \bmod > > > It will show as red text. Press down arrow while it still is red, > > > and lyx crashes with the usual emergency save. > > > > > > Pressing space or anything else that changes the hand-typed fucntion > > > name from red to black avoids this crash. I can then exit the math inset > > > using the down arrow. > > > > > > Helge Hafting > > > > Yes, I see that too. With any red function, in fact -- but it has to be > > a _legal_ one. > > > > - Martin > > OK, here's a patch for this one. The problem is an unfinished math macro > is already defined as an inset, but hasn't drawn + added a coordinate > cache entry yet. So it now tests for macro mode and does nothing then. > > (Were there any other keys that did this?) > > This contains the ncols() cursor pos fix and the deco/font wrap around > selection stuff as well. > > I'll soon check in both, unless someone spots something fishy. > > - Martin
Nice, those small attachments ;-/
Index: math_nestinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v retrieving revision 1.148 diff -u -r1.148 math_nestinset.C --- math_nestinset.C 4 Apr 2005 22:11:53 -0000 1.148 +++ math_nestinset.C 6 Apr 2005 15:40:55 -0000 @@ -496,6 +496,7 @@ case LFUN_UPSEL: case LFUN_UP: + if (cur.inMacroMode()) break; cur.selHandle(cmd.action == LFUN_UPSEL); if (!cur.up()) cmd = FuncRequest(LFUN_FINISHED_UP); @@ -505,6 +506,7 @@ case LFUN_DOWNSEL: case LFUN_DOWN: + if (cur.inMacroMode()) break; cur.selHandle(cmd.action == LFUN_DOWNSEL); if (!cur.down()) cmd = FuncRequest(LFUN_FINISHED_DOWN); @@ -557,7 +559,7 @@ cur.clearTargetX(); if (cur.pos() != cur.lastpos()) { cur.pos() = cur.lastpos(); - } else if (cur.col() != cur.lastcol()) { + } else if (ncols() && (cur.col() != cur.lastcol())) { cur.idx() = cur.idx() - cur.col() + cur.lastcol(); cur.pos() = cur.lastpos(); } else if (cur.idx() != cur.lastidx()) { @@ -795,10 +797,16 @@ // FIXME: We probably should swap parts of "math-insert" and "self-insert" // handling such that "self-insert" works on "arbitrary stuff" too, and // math-insert only handles special math things like "matrix". - case LFUN_INSERT_MATH: + case LFUN_INSERT_MATH: { recordUndo(cur, Undo::ATOMIC); - cur.niceInsert(cmd.argument); + MathArray ar; + asArray(cmd.argument, ar); + if (ar.size() == 1 && (ar[0].nucleus()->asNestInset())) { + cur.handleNest(ar[0]); + } else + cur.niceInsert(cmd.argument); break; + } case LFUN_DIALOG_SHOW_NEW_INSET: { string const & name = cmd.argument;
signature.asc
Description: This is a digitally signed message part