On Mon, 2006-03-20 at 10:39 +0100, Jean-Marc Lasgouttes wrote: > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> Bit more polished version attached. This one goes in. Log > Martin> message: > > I don't see the patch.
Oops. Here it is. > Also, looking at what got committed, I think you forgot to remove > paste() from cursor.h. Grml... yes. > Finally, I do not like much the name safe_ (don't understand what this > means). Combining with the fact that you did not document it, we get > code difficult to understand. Yes, I agree. I inherited the bad name. What would be a better name: save_selection_? > Apart from that, I'd be favourable to inclusion of this in 1.4.x once > it is well tested. - Martin
Index: cursor.C =================================================================== --- cursor.C (revision 13423) +++ cursor.C (revision 13424) @@ -379,15 +379,6 @@ } -// Don't use this routine. It is erroneous: LFUN_PASTE should be called with -// buffer number, not data to be inserted -- MV 26.02.2006 -void LCursor::paste(string const & data) -{ - if (!data.empty()) - dispatch(FuncRequest(LFUN_PASTE, data)); -} - - void LCursor::resetAnchor() { anchor_ = *this; Index: mathed/math_nestinset.C =================================================================== --- mathed/math_nestinset.C (revision 13423) +++ mathed/math_nestinset.C (revision 13424) @@ -712,6 +712,7 @@ // do superscript if LyX handles // deadkeys recordUndo(cur, Undo::ATOMIC); + safe_ = grabAndEraseSelection(cur); script(cur, true); } break; @@ -883,12 +884,10 @@ // math-insert only handles special math things like "matrix". case LFUN_INSERT_MATH: { recordUndo(cur, Undo::ATOMIC); - MathArray ar; - asArray(cmd.argument, ar); - int cell(0); - if (cmd.argument == "\\root") - cell = 1; - cur.niceInsert(cmd.argument); + if (cmd.argument == "^" || cmd.argument == "_") { + interpret(cur, cmd.argument[0]); + } else + cur.niceInsert(cmd.argument); break; } @@ -1094,6 +1093,9 @@ bool MathNestInset::interpret(LCursor & cur, char c) { //lyxerr << "interpret 2: '" << c << "'" << endl; + if (c == '^' || c == '_') + safe_ = grabAndEraseSelection(cur); + cur.clearTargetX(); // handle macroMode @@ -1246,7 +1248,6 @@ } cur.macroModeClose(); - string safe = grabAndEraseSelection(cur); if (asScriptInset() && cur.idx() == 0) { // we are in a nucleus of a script inset, move to _our_ script MathScriptInset * inset = asScriptInset(); @@ -1277,9 +1278,9 @@ cur.idx() = 1; cur.pos() = 0; } - //lyxerr << "pasting 1: safe:\n" << safe << endl; - cur.paste(safe); + //lyxerr << "inserting 1: safe:\n" << safe_ << endl; + cur.niceInsert(safe_); cur.resetAnchor(); - //lyxerr << "pasting 2: safe:\n" << safe << endl; + //lyxerr << "inserting 2: safe:\n" << safe_ << endl; return true; } Index: mathed/math_nestinset.h =================================================================== --- mathed/math_nestinset.h (revision 13423) +++ mathed/math_nestinset.h (revision 13424) @@ -128,6 +128,8 @@ cells_type cells_; /// if the inset is locked, it can't be entered with the cursor bool lock_; + /// + std::string safe_; }; #endif
signature.asc
Description: This is a digitally signed message part