Am Sonntag, 26. Februar 2006 17:53 schrieb Martin Vermeer: > Yes... but now insertion of a decoration "around" selected math text > fails. The problem which this patch originally tried to fix.
Of course. The patch was only meant to show where the problem is, it was by no means a finished fix. > The assumption here appears to be that the argument to give to the > LFUN_PASTE call is the _text_ to be pasted into the doc. Checking the > places where LFUN_PASTE is executed (i.e., text2.C and > math_nestinset.C), however, shows that the text to be pasted comes from > _buffer number_ n, an integer contained in the cmd.argument transferred. > > So I believe there is a "thinko" here, which explains why the > selection disappears into the black hole and is never inserted -- at > least for math. That is indeed a problem, but unrelated, because LCursor::paste() is not invoked for \mathbb. I filed it at http://bugzilla.lyx.org/show_bug.cgi?id=2327 and attached also a possible fix. There seems to be a different thinko involved in the \mathbb problem: LCursor::handleNest() operates on a selection, but the selection may be empty if you insert '\mathbb R' from the math panel (and its contents will be wrong even if it is not empty). The attached patch improves the situation a bit by invoking handleNest() only if there is a selection. That makes '\mathbb R' work again for the case where nothing is selected. If you try to insert '\mathbb R' over a selection, you'll convert the selection to \mathbb font. That is also the case in 1.3, but in 1.3 you'll get additionally the roginila mathbb argument, which is missing with the patch, so some more work needs to be done. Georg
Index: src/mathed/math_nestinset.C =================================================================== --- src/mathed/math_nestinset.C (Revision 13276) +++ src/mathed/math_nestinset.C (Arbeitskopie) @@ -890,7 +890,8 @@ void MathNestInset::doDispatch(LCursor & 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()) && + if (cur.selection() && ar.size() == 1 && + ar[0].nucleus()->asNestInset() && ar[0].nucleus()->nargs() > MathInset::idx_type(cell)) { cur.handleNest(ar[0], cell); } else