On Thu, Jun 22, 2006 at 04:05:34PM +0200, Jean-Marc Lasgouttes wrote:
> >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:

... 
 
> Running under gdb, I noticed that InsetCollapsable::metrics is called
> twice when creating a new note inset. The reason is that it is called
> twice in InsetTabular::metrics:
> 
>               if (!p_width.zero())
>                       m.base.textwidth = p_width.inPixels(mi.base.textwidth);
>               tabular.getCellInset(cell)->metrics(m, dim);
>               if (!p_width.zero())
>                       dim.wid = m.base.textwidth;
>               tabular.setWidthOfCell(cell, dim.wid);
>               if (p_width.zero()) {
>                       m.base.textwidth = dim.wid + 1;
>                       tabular.getCellInset(cell)->metrics(m, dim);
>               }

Hmmm. Note that these are metrics calls for the _cell_ of the tabular,
i.e., an InsetText. Which indeed trickle down to calls for InsetNote.
Note also that this only happens if the column width is not set fixed.
 
> Isn't there a way to reduce to one call? The first call sets
> openinlined_ to true, the second one to false.

Yes, that was my theory too.

> When typing in the note inset, it gets worse: every key generates 6
> calls to InsetCollapsable::metrics !

I believe you :-) Now set the column width to a fixed value and try
again. Also, make sure the note is alone on its row, and try again.

> Martin> An easier fix might be to have another look at the
> Martin> openinlined_ behaviour in insetcollapsable.
> 
> It looks reasonable to me, provided that we give the right data as
> input. What I am not sure of, is what value of openinlined_ we want to
> obtain. I tend to think it should be true whenever possible.

I suggest something like

        openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth();

That way it becomes independent from the handed-down "available space"
in mi.base.textwidth, which will fix the bug. Or so I would believe.
 
> Martin> Shall I commit this patch to 1.4 (and 1.5) as it creates sane
> Martin> behaviour with only a cosmetic wart?
> 
> I'll try to play with it myself.

Good luck...

- Martin

Attachment: pgpnX1Nf4mWre.pgp
Description: PGP signature

Reply via email to