Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Jan 10, 2006 at 12:53:39PM +0100, Jean-Marc Lasgouttes wrote: Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre prevAtom(). Or maybe nextAtom(). Should be near the cursor, Andre shouldn't it? OK, here is my next try. I kind of like the code now, so I'd really want to commit it and be done with this bug? It looks ok. No more objections from my side. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Jan 10, 2006 at 07:35:14AM +0100, Jean-Marc Lasgouttes wrote: Andre == Andre Poenitz [EMAIL PROTECTED] writes: Not really, because it is only in macroMathClose that I have access to the object that has been created there. How would I access the newly built \frac{}{} object otherwise? Andre prevAtom(). Or maybe nextAtom(). Should be near the cursor, Andre shouldn't it? But if I do not know whether macromodeclose added something? Shall I make it return a bool? Why not. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Jan 10, 2006 at 12:53:39PM +0100, Jean-Marc Lasgouttes wrote: > > "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > Andre> prevAtom(). Or maybe nextAtom(). Should be near the cursor, > Andre> shouldn't it? > > OK, here is my next try. I kind of like the code now, so I'd really > want to commit it and be done with this bug? It looks ok. No more objections from my side. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Jan 10, 2006 at 07:35:14AM +0100, Jean-Marc Lasgouttes wrote: > > "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > >> Not really, because it is only in macroMathClose that I have > >> access to the object that has been created there. How would I > >> access the newly built \frac{}{} object otherwise? > > Andre> prevAtom(). Or maybe nextAtom(). Should be near the cursor, > Andre> shouldn't it? > > But if I do not know whether macromodeclose added something? Shall I > make it return a bool? Why not. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Jan 09, 2006 at 06:05:09PM +0100, Jean-Marc Lasgouttes wrote: Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre Can't you simply put the new stuff in a separate function? I Andre always have a feeling that additional bool parameters do not Andre improve readability, especially when the function in question Andre basically looks like Andre void foo(bool b) { if (b) do_something(); else Andre do_something_else(); Andre } Not really, because it is only in macroMathClose that I have access to the object that has been created there. How would I access the newly built \frac{}{} object otherwise? prevAtom(). Or maybe nextAtom(). Should be near the cursor, shouldn't it? However Martin said that the patch makes errors when loading the userguide. I'll have to check that. That's bad indeed. I am seriously thinking about undoing my earlier patch (which leads to crashes) and keeping the bug open for now. Hm. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Jan 09, 2006 at 06:05:09PM +0100, Jean-Marc Lasgouttes wrote: > > "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > Andre> Can't you simply put the new stuff in a separate function? I > Andre> always have a feeling that additional bool parameters do not > Andre> improve readability, especially when the function in question > Andre> basically looks like > > Andre> void foo(bool b) { if (b) do_something(); else > Andre> do_something_else(); > Andre> } > > Not really, because it is only in macroMathClose that I have access to > the object that has been created there. How would I access the newly > built \frac{}{} object otherwise? prevAtom(). Or maybe nextAtom(). Should be near the cursor, shouldn't it? > However Martin said that the patch makes errors when loading the > userguide. I'll have to check that. That's bad indeed. > I am seriously thinking about undoing my earlier patch (which leads to > crashes) and keeping the bug open for now. Hm. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Wed, Dec 28, 2005 at 05:24:27PM +0100, Jean-Marc Lasgouttes wrote: Andre == Andre Poenitz [EMAIL PROTECTED] writes: So, what do you propose? I guess I could keep mathMacroClose as it was, Andre Yes. and put the cursor inside the new inset only when space was pressed? What about that one? Can't you simply put the new stuff in a separate function? I always have a feeling that additional bool parameters do not improve readability, especially when the function in question basically looks like void foo(bool b) { if (b) do_something(); else do_something_else(); } Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Wed, Dec 28, 2005 at 05:24:27PM +0100, Jean-Marc Lasgouttes wrote: > > "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > >> So, what do you propose? I guess I could keep mathMacroClose as it > >> was, > > Andre> Yes. > > >> and put the cursor inside the new inset only when space was > >> pressed? > > What about that one? Can't you simply put the new stuff in a separate function? I always have a feeling that additional bool parameters do not improve readability, especially when the function in question basically looks like void foo(bool b) { if (b) do_something(); else do_something_else(); } Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Wed, Dec 28, 2005 at 05:24:27PM +0100, Jean-Marc Lasgouttes wrote: Andre == Andre Poenitz [EMAIL PROTECTED] writes: So, what do you propose? I guess I could keep mathMacroClose as it was, Andre Yes. and put the cursor inside the new inset only when space was pressed? What about that one? JMarc I am getting lots of math errors when loading the User Guide, like unusual contents found from math_parser.C. Could this come from this patch? Current CVS. - Martin pgphPSvQ262DQ.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Wed, Dec 28, 2005 at 05:24:27PM +0100, Jean-Marc Lasgouttes wrote: > > "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: > > >> So, what do you propose? I guess I could keep mathMacroClose as it > >> was, > > Andre> Yes. > > >> and put the cursor inside the new inset only when space was > >> pressed? > > What about that one? > > JMarc > I am getting lots of math errors when loading the User Guide, like "unusual contents found" from math_parser.C. Could this come from this patch? Current CVS. - Martin pgphPSvQ262DQ.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Fri, Dec 23, 2005 at 10:53:28AM +0100, Jean-Marc Lasgouttes wrote: 1/ copy this seemingly (to me) fragile code to macroModeClose -or- 2/ invoke dispatch directly (but add a warning telling this should be fixed) -or- 3/ create yet another LCursor::fooInsert method, inorder to make really sure that people will never be able to figure out which one should be used :) Andre Have you checked this leaves the callers intact? Andre I.e. typed \fracCtrl-Left and such? Erm. It crashes :( As suspected. Most callers of macrModeClose rely on the fact that the cursor does not move. So, what do you propose? I guess I could keep mathMacroClose as it was, Yes. and put the cursor inside the new inset only when space was pressed? Yes. And edit(cur, false) or similar could help. Or check whether the freshly created inset has cells (nargs() 0), nter it (push_something), set idx and pos (call idxFirst or such). Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Fri, Dec 23, 2005 at 10:53:28AM +0100, Jean-Marc Lasgouttes wrote: > 1/ copy this seemingly (to me) fragile code to macroModeClose > -or- > 2/ invoke dispatch directly (but add a warning telling this should be fixed) > -or- > 3/ create yet another LCursor::fooInsert method, inorder to make > really sure that people will never be able to figure out which one > should be used :) > > > Andre> Have you checked this leaves the callers intact? > > Andre> I.e. typed \frac and such? > > Erm. It crashes :( As suspected. Most callers of macrModeClose rely on the fact that the cursor does not move. > So, what do you propose? I guess I could keep mathMacroClose as it > was, Yes. > and put the cursor inside the new inset only when space was pressed? Yes. And edit(cur, false) or similar could help. Or check whether the freshly created inset has cells (nargs() > 0), nter it (push_something), set idx and pos (call idxFirst or such). Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 04:06:06PM +0200, Martin Vermeer wrote: On Tue, Dec 20, 2005 at 02:51:13PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Yes, I see. I think your patch is precisely the right one as Martin this method is called whenever a macro has been typed in. And Martin it is minimal. Here is the alternative that does not use dispatch (I copied blindly the code instead). Which one do you prefer? JMarc N... unless we *know* that the use of dispatch is a speed issue, we should keep it simple. This is not about speed. This is about walking down to the guts and hopping up just a step before we arrive. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 03:59:39PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Alternatively, put this in a method and call that from both Martin places. Yes, but insert, plainInsert and niceInsert are already taken, I do not have any new idea for a confusing name :) I propose keep the dispatch and add a comment telling to do something better later. OK? Have you checked this leaves the callers intact? I.e. typed \fracCtrl-Left and such? Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 12:05:40AM +0200, Martin Vermeer wrote: On Mon, Dec 19, 2005 at 10:49:08PM +0100, Andre Poenitz wrote: On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Confirmed. This problem happens if you try to to type LaTeX Martin directly. It works correctly from the panel. The following patch seems to fix the bug. André, can you ack that this is correct? dicpatch() is a bit heavy in this depth (it can have all sort of side effects), so I'd personally prefer calling a direct method. But if you have checked it works, it is fine with me. The following is perhaps lighter, and could be considered an alternative if there are side effects. (But this may have such as well.) - Martin Index: math_nestinset.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v retrieving revision 1.179 diff -u -p -r1.179 math_nestinset.C --- math_nestinset.C 2 Dec 2005 06:34:19 - 1.179 +++ math_nestinset.C 19 Dec 2005 21:35:29 - @@ -1129,8 +1129,14 @@ bool MathNestInset::interpret(LCursor return true; } - // leave macro mode and try again if necessary - cur.macroModeClose(); + // Route the accumulated macro name through INSERT_MATH for + // cursor positioning: + FuncRequest cmd = FuncRequest(LFUN_INSERT_MATH, cur.macroName()); + MathUnknownInset * p = cur.activeMacro(); + if (p) + p-setName(\\); + MathNestInset::doDispatch(cur, cmd); + // Try again if necessary if (c == '{') cur.niceInsert(MathAtom(new MathBraceInset)); else if (c != ' ') What's the actual cursor positioning problem? I'd really like to get that fixed by direct calls. Something like if (cur.nextAtom()-nargs() 0) edit(cur, true); or some call to idxFirst... Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 12:44:50PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes Martin wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin ... Martin Confirmed. This problem happens if you try to to type LaTeX Martin directly. It works correctly from the panel. The following patch seems to fix the bug. André, can you ack that this is correct? Martin Same idea I had, but applied in a different place. plainInsert Martin is called in a lot of places; are you sure this doesn't have Martin side effects? I do not change plainInsert, I change macroModeClose. macroModeClose is also used a dozen times or so... Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 04:06:06PM +0200, Martin Vermeer wrote: > On Tue, Dec 20, 2005 at 02:51:13PM +0100, Jean-Marc Lasgouttes wrote: > > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > Martin> Yes, I see. I think your patch is precisely the right one as > > Martin> this method is called whenever a macro has been typed in. > > And Martin> it is minimal. > > > > Here is the alternative that does not use dispatch (I copied blindly > > the code instead). > > > > Which one do you prefer? > > > > JMarc > > N... unless we *know* that the use of dispatch is a speed issue, > we should keep it simple. This is not about speed. This is about walking down to the guts and hopping up just a step before we arrive. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 03:59:39PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Alternatively, put this in a method and call that from both > Martin> places. > > Yes, but insert, plainInsert and niceInsert are already taken, I do > not have any new idea for a confusing name :) > > I propose keep the dispatch and add a comment telling to do something > better later. > > OK? Have you checked this leaves the callers intact? I.e. typed \frac and such? Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 12:05:40AM +0200, Martin Vermeer wrote: > On Mon, Dec 19, 2005 at 10:49:08PM +0100, Andre Poenitz wrote: > > On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: > > > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > > Martin> Confirmed. This problem happens if you try to to type LaTeX > > > Martin> directly. It works correctly from the panel. > > > > > > The following patch seems to fix the bug. > > > > > > André, can you ack that this is correct? > > > > dicpatch() is a bit heavy in this depth (it can have all sort of side > > effects), so I'd personally prefer calling a direct method. > > > > But if you have checked it works, it is fine with me. > > The following is perhaps lighter, and could be considered an alternative > if there are side effects. (But this may have such as well.) > > - Martin > Index: math_nestinset.C > === > RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v > retrieving revision 1.179 > diff -u -p -r1.179 math_nestinset.C > --- math_nestinset.C 2 Dec 2005 06:34:19 - 1.179 > +++ math_nestinset.C 19 Dec 2005 21:35:29 - > @@ -1129,8 +1129,14 @@ bool MathNestInset::interpret(LCursor & > return true; > } > > - // leave macro mode and try again if necessary > - cur.macroModeClose(); > + // Route the accumulated macro name through INSERT_MATH for > + // cursor positioning: > + FuncRequest cmd = FuncRequest(LFUN_INSERT_MATH, > cur.macroName()); > + MathUnknownInset * p = cur.activeMacro(); > + if (p) > + p->setName("\\"); > + MathNestInset::doDispatch(cur, cmd); > + // Try again if necessary > if (c == '{') > cur.niceInsert(MathAtom(new MathBraceInset)); > else if (c != ' ') What's the actual cursor positioning problem? I'd really like to get that fixed by direct calls. Something like if (cur.nextAtom()->nargs() > 0) edit(cur, true); or some call to idxFirst... Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 12:44:50PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes > Martin> wrote: > >> > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> ... > > Martin> Confirmed. This problem happens if you try to to type LaTeX > Martin> directly. It works correctly from the panel. > >> The following patch seems to fix the bug. > >> > >> André, can you ack that this is correct? > > Martin> Same idea I had, but applied in a different place. plainInsert > Martin> is called in a lot of places; are you sure this doesn't have > Martin> side effects? > > I do not change plainInsert, I change macroModeClose. macroModeClose is also used a dozen times or so... Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 02:51:13PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Yes, I see. I think your patch is precisely the right one as Martin this method is called whenever a macro has been typed in. And Martin it is minimal. Here is the alternative that does not use dispatch (I copied blindly the code instead). Which one do you prefer? JMarc N... unless we *know* that the use of dispatch is a speed issue, we should keep it simple. Alternatively, put this in a method and call that from both places. - Martin pgpRuMjgX0VAG.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 03:59:39PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Alternatively, put this in a method and call that from both Martin places. Yes, but insert, plainInsert and niceInsert are already taken, I do not have any new idea for a confusing name :) insertWithCursorPositioning? I propose keep the dispatch and add a comment telling to do something better later. OK? OK - Martin pgpUya7rTrCI7.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 02:51:13PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Yes, I see. I think your patch is precisely the right one as > Martin> this method is called whenever a macro has been typed in. And > Martin> it is minimal. > > Here is the alternative that does not use dispatch (I copied blindly > the code instead). > > Which one do you prefer? > > JMarc N... unless we *know* that the use of dispatch is a speed issue, we should keep it simple. Alternatively, put this in a method and call that from both places. - Martin pgpRuMjgX0VAG.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Tue, Dec 20, 2005 at 03:59:39PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Alternatively, put this in a method and call that from both > Martin> places. > > Yes, but insert, plainInsert and niceInsert are already taken, I do > not have any new idea for a confusing name :) insertWithCursorPositioning? > I propose keep the dispatch and add a comment telling to do something > better later. > > OK? OK - Martin pgpUya7rTrCI7.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin On Mon, 2005-12-19 at 00:42 -0500, Grag wrote: I noticed some difference between the behavior of the mathinset that is inconsistent with lyx 1.3.x For instance 1) enter math inset 2) \hat 3) \beta In lyx 1.3.x the beta would be placed under the hat frame, while under lyx1.4cvs the beta is placed on the right of the hat frame. The same happens with other frame decoration (e.g. tilde, dot, etc.). Similarly, 1) enter math inset 2) \frac 3) \sum The sum is on the right of the frac frame. In lyx 1.3.x the sum will be placed in the numerator. In lyx1.4cvs on the right side of the frac. Martin Confirmed. This problem happens if you try to to type LaTeX Martin directly. It works correctly from the panel. The following patch seems to fix the bug. André, can you ack that this is correct? dicpatch() is a bit heavy in this depth (it can have all sort of side effects), so I'd personally prefer calling a direct method. But if you have checked it works, it is fine with me. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: ... Martin Confirmed. This problem happens if you try to to type LaTeX Martin directly. It works correctly from the panel. The following patch seems to fix the bug. André, can you ack that this is correct? Same idea I had, but applied in a different place. plainInsert is called in a lot of places; are you sure this doesn't have side effects? - Martin pgpwK2oMAn338.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 10:49:08PM +0100, Andre Poenitz wrote: On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: Martin == Martin Vermeer [EMAIL PROTECTED] writes: Martin Confirmed. This problem happens if you try to to type LaTeX Martin directly. It works correctly from the panel. The following patch seems to fix the bug. André, can you ack that this is correct? dicpatch() is a bit heavy in this depth (it can have all sort of side effects), so I'd personally prefer calling a direct method. But if you have checked it works, it is fine with me. The following is perhaps lighter, and could be considered an alternative if there are side effects. (But this may have such as well.) - Martin Index: math_nestinset.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v retrieving revision 1.179 diff -u -p -r1.179 math_nestinset.C --- math_nestinset.C2 Dec 2005 06:34:19 - 1.179 +++ math_nestinset.C19 Dec 2005 21:35:29 - @@ -1129,8 +1129,14 @@ bool MathNestInset::interpret(LCursor return true; } - // leave macro mode and try again if necessary - cur.macroModeClose(); + // Route the accumulated macro name through INSERT_MATH for + // cursor positioning: + FuncRequest cmd = FuncRequest(LFUN_INSERT_MATH, cur.macroName()); + MathUnknownInset * p = cur.activeMacro(); + if (p) + p-setName(\\); + MathNestInset::doDispatch(cur, cmd); + // Try again if necessary if (c == '{') cur.niceInsert(MathAtom(new MathBraceInset)); else if (c != ' ') pgpAbkggoJ4zU.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> On Mon, 2005-12-19 at 00:42 -0500, Grag wrote: > >> I noticed some difference between the behavior of the mathinset > >> that is inconsistent with lyx 1.3.x > >> > >> For instance 1) enter math inset 2) \hat 3) \beta In lyx 1.3.x the > >> beta would be placed under the hat frame, while under lyx1.4cvs the > >> beta is placed on the right of the hat frame. The same happens with > >> other frame decoration (e.g. tilde, dot, etc.). Similarly, 1) enter > >> math inset 2) \frac 3) \sum The sum is on the right of the frac > >> frame. In lyx 1.3.x the sum will be placed in the numerator. In > >> lyx1.4cvs on the right side of the frac. > > Martin> Confirmed. This problem happens if you try to to type LaTeX > Martin> directly. It works correctly from the panel. > > The following patch seems to fix the bug. > > André, can you ack that this is correct? dicpatch() is a bit heavy in this depth (it can have all sort of side effects), so I'd personally prefer calling a direct method. But if you have checked it works, it is fine with me. Andre'
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: ... > Martin> Confirmed. This problem happens if you try to to type LaTeX > Martin> directly. It works correctly from the panel. > > The following patch seems to fix the bug. > > André, can you ack that this is correct? Same idea I had, but applied in a different place. plainInsert is called in a lot of places; are you sure this doesn't have side effects? - Martin pgpwK2oMAn338.pgp Description: PGP signature
Re: [PATCH] Re: Mathinset b ehavior (André?)
On Mon, Dec 19, 2005 at 10:49:08PM +0100, Andre Poenitz wrote: > On Mon, Dec 19, 2005 at 05:39:42PM +0100, Jean-Marc Lasgouttes wrote: > > > "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Confirmed. This problem happens if you try to to type LaTeX > > Martin> directly. It works correctly from the panel. > > > > The following patch seems to fix the bug. > > > > André, can you ack that this is correct? > > dicpatch() is a bit heavy in this depth (it can have all sort of side > effects), so I'd personally prefer calling a direct method. > > But if you have checked it works, it is fine with me. The following is perhaps lighter, and could be considered an alternative if there are side effects. (But this may have such as well.) - Martin Index: math_nestinset.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v retrieving revision 1.179 diff -u -p -r1.179 math_nestinset.C --- math_nestinset.C2 Dec 2005 06:34:19 - 1.179 +++ math_nestinset.C19 Dec 2005 21:35:29 - @@ -1129,8 +1129,14 @@ bool MathNestInset::interpret(LCursor & return true; } - // leave macro mode and try again if necessary - cur.macroModeClose(); + // Route the accumulated macro name through INSERT_MATH for + // cursor positioning: + FuncRequest cmd = FuncRequest(LFUN_INSERT_MATH, cur.macroName()); + MathUnknownInset * p = cur.activeMacro(); + if (p) + p->setName("\\"); + MathNestInset::doDispatch(cur, cmd); + // Try again if necessary if (c == '{') cur.niceInsert(MathAtom(new MathBraceInset)); else if (c != ' ') pgpAbkggoJ4zU.pgp Description: PGP signature