On Fri, Oct 10, 2003 at 12:39:44PM +0100, John Levon spake thusly: > > On Fri, Oct 10, 2003 at 08:57:03AM +0000, Angus Leeming wrote: > > > I attach Martin's original patch, 1147 lines. Could people look it > > over again in the light of our current experience and comment on > > which bits should be returned. > > I have not been following this discussion (sorry), but reverting stuff > seems a bit of an odd thing to do given what's happened to the tree. > > It /should/ be up to the inset to make sure it gets its own full line, > it's one step towards proper layout. Putting the logic in the core code > makes things really unpleasant, nextRowIsFullInset or whatever it's > called is ample proof of that.
I agree with you in principle... but this is a little trickier than that. What the inset does, is go in its entirety to the next line (row), as it has been made to announce to the world that its width is the same as the text width. An elegant solution, only... the line above it then becomes stretched (filled) from margin to margin, producing very wide spaces between words. Ugly, as Jean-Marc was entitled to complain. Somehow the inset should announce that the line above it is *not* to be stretched... but responding to that announcement is the job of the core IMHO. What I *don't* like is the complex way all over the place that the old core did this. That should indeed be avoided (if restoring it cleanly is indeed possible any more). One approach I am thinking of is the following, using only one point of control in the core (text2.C, 580-588 is the new stuff): 575 int par_width = 0; 576 // set height and fill and width of rows 577 int const ww = workWidth(); 578 for (rit = pit->rows.begin(); rit != end; ++rit) { 579 int f = fill(pit, rit, ww); 580 // Position of next char: 581 pos_type z = rit->end() + 1; 582 // Is this an inset in "display" mode? 583 if (pit->isInset(z)) { 584 InsetOld * inset = pit->getInset(z); 585 if (inset->breakLineBefore()) // bool to be impl 586 // suppress filling of line 587 f = 0; 588 } 589 int const w = ww - f; 590 par_width = std::max(par_width, w); 591 rit->fill(f); 592 rit->width(w); 593 prepareToPrint(pit, rit); 594 setHeightOfRow(pit, rit); 595 height += rit->height(); 596 } Completely untested, just given here to illustrate my thinking... > See my many mails in the past on where we should be heading with this > ... but since I'm not the one who's actually going to be doing anything > about it, I can't complain too loudly ... Sometimes the little boy sees how the Emperor is dressed... > regards > john Best, Martin
pgp00000.pgp
Description: PGP signature