Am Sonntag, 26. Februar 2006 20:53 schrieb Martin Vermeer: > Attached the best I can come up with for now. Working are: > > 1) fonts from the panel around selection > 2) decorations from the panel over/under selection > 3) compound symbols from the panel, type \mathbb R, without sel > 4) same with sel: result [sel|R] in mathbb font. I say we can live with > that.
Sorry to complain again, but the patch does not work with 2) and 4) if the selection contains more than simple characters. The reason is that LCursor::insert(string) inserts the string character by character, and does not interpret things like \frac. Fortunately this is easy to fix, see the attached patch. > I propose this as the patch for 1.4.1 (not 1.4.0 I think; it's cosmetic > and there's a workaround). I agree with Joost that it should be in 1.4.0. This is a major problem, and LCursor::paste() is so utterly broken that every replacement that works at least in one single case is better. Georg
Index: src/cursor.C =================================================================== --- src/cursor.C (Revision 13276) +++ src/cursor.C (Arbeitskopie) @@ -379,6 +379,8 @@ void LCursor::getPos(int & x, int & y) c } +// 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()) @@ -707,12 +709,15 @@ void LCursor::niceInsert(MathAtom const string const safe = lyx::cap::grabAndEraseSelection(*this); plainInsert(t); // enter the new inset and move the contents of the selection if possible - if (t->isActive()) { + if (t->isActive() && !safe.empty()) { posLeft(); // be careful here: don't use 'pushLeft(t)' as this we need to // push the clone, not the original pushLeft(*nextInset()); - paste(safe); + // We may not use niceInsert here (recursion) + MathArray ar; + asArray(safe, ar); + insert(ar); } } Index: src/mathed/math_nestinset.C =================================================================== --- src/mathed/math_nestinset.C (Revision 13276) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -888,13 +888,7 @@ void MathNestInset::doDispatch(LCursor & int cell(0); if (cmd.argument == "\\root") cell = 1; - // math macros are nest insets and may have 0 cells. - // handleNest would crash in this case. - if (ar.size() == 1 && (ar[0].nucleus()->asNestInset()) && - ar[0].nucleus()->nargs() > MathInset::idx_type(cell)) { - cur.handleNest(ar[0], cell); - } else - cur.niceInsert(cmd.argument); + cur.niceInsert(cmd.argument); break; }