On Mon, Apr 09, 2007 at 02:07:27PM +0200, Jürgen Spitzmüller wrote: > The problem is the following: > the "wide" property is always set for text insets if the inset is alone on > the > given row, also if we are nested in another inset which is itself not wide > (such as in the test case in the bug report). > > The solution is to check whether the inset is nested and whether the parent > inset is itself wide. The attached patch does this, however, I'm not sure it > is the most elegant solution (apart from ditching the wide thing altogether).
No... but the logic seems impeccable. Ditching wide while retaining the speed gain would be great... > So please comment. A remark that this can go as soon as 'wide' goes? But then there are many more places... > BTW repainting is very sluggish especially when using the mouse. If I put the > cursor from a widen inset to the position just before the inset, LyX needs > _seconds_ until the inset is repainted. Well yes... that's the price of repainting the whole inset. Why we have the 'wide' trick, so we don't pay it for every character typed. Still,_seconds_ sounds like too much. > Jürgen > Index: src/rowpainter.C > =================================================================== > --- src/rowpainter.C (Revision 17755) > +++ src/rowpainter.C (Arbeitskopie) > @@ -876,6 +876,23 @@ > } > > > +bool inNarrowInset(PainterInfo & pi) > +{ > + // check whether the current inset is nested in a non-wide inset > + LCursor & cur = pi.base.bv->cursor(); > + for (int i = cur.depth() - 1; --i >= 0; ) { > + InsetBase * const in = &cur[i].inset(); > + if (in) { > + InsetText * t = > + const_cast<InsetText *>(in->asTextInset()); > + if (t) > + return !t->wide(); > + } > + } > + return false; > +} > + > + > void paintPar > (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y, > bool repaintAll) > @@ -905,8 +922,8 @@ > bool row_has_changed = pm.rowChangeStatus()[rowno]; > > bool cursor_on_row = CursorOnRow(pi, pit, rit, text); > - bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit, > - text); > + bool in_inset_alone_on_row = > + innerCursorOnRow(pi, pit, rit, text); > bool leftEdgeFixed = > (par.getAlign() == LYX_ALIGN_LEFT || > par.getAlign() == LYX_ALIGN_BLOCK); > @@ -922,7 +939,9 @@ > if (in) { > InsetText * t = const_cast<InsetText > *>(in->asTextInset()); > if (t) > - t->setWide(in_inset_alone_on_row && > leftEdgeFixed); > + t->setWide(in_inset_alone_on_row > + && leftEdgeFixed > + && !inNarrowInset(pi)); > } > } >