Candidate commit: "white-space: pre"

Allan Sandfeld Jensen kde at carewolf.com
Mon Dec 27 19:22:45 GMT 2004


On Monday 27 December 2004 20:05, Leo Savernik wrote:
> Am Montag, 27. Dezember 2004 19:27 schrieb Allan Sandfeld Jensen:
> > Hi everybody and "glædelig jul"
>
> You're Swedish? I've always thought you were an US inhabitant.
>

That is two wrong guesses; I am danish :) (also the Æ should have clued you 
in, since the swedish was too cheap to modify the imported german typewriters 
and mostly ditched æ,ø and å two centuries ago to german umlauts)

>
> > @@ -352,8 +353,7 @@ bool KHTMLParser::insertNode(NodeImpl *n
> >         // never create anonymous objects just to hold a space.
> >         if ( id == ID_TEXT &&
> >              static_cast<TextImpl *>(n)->string()->l == 1 &&
> > -            (static_cast<TextImpl *>(n)->string()->s[0] == ' ' ||
> > -              static_cast<TextImpl *>(n)->string()->s[0] == '\n'))
> > +             static_cast<TextImpl *>(n)->string()->s[0] == " " )
>
> Is the usage of a char * instead of a char intentional?
>
This is infact a revert of some code that leaked out of my sandbox a week ago. 
It seems the old code was odd, I will fix it.

>
> > -inline int closeWordAndGetWidth(const QFontMetrics &fm, const QChar
> > *str,
>
> int pos,
>
> > +inline int closeWordAndGetWidth(const QFontMetrics &fm, const QString
> > str,
>
> int pos,
>
> Passing a QString, and that one const? Didn't you forget the reference?
>
Yes, thanks.

> >         int wordStart, int wordEnd)
> >  {
> >      if (wordEnd <= wordStart) return 0;
> >  
> > -    QConstString s(str + pos + wordStart, wordEnd - wordStart);
> > -    return fm.width(s.string());
> > +    //QConstString s(str + pos + wordStart, wordEnd - wordStart);
> > +    const QString s = str.mid(pos + wordStart, wordEnd - wordStart);
> > +    return fm.width(s);
>
> Can you elaborate on that change, please?
>
The point is that I've added a cleaning run in the beginning of drawText. 
Unfortunatly the function is very unconsistent and uses both the QChar* str, 
the QString qstr and various QConstStrings. Since I've only cleaned qstr, 
I've modified all of the function to more consistent and _only_ work with 
qstr and substrings of it.

`Allan




More information about the kfm-devel mailing list