Fix for setSelection( htmlDocument().createRange() )

David Faure faure at kde.org
Fri Nov 5 11:35:39 GMT 2004


On Friday 05 November 2004 12:31, Leo Savernik wrote:
> Am Freitag, 5. November 2004 10:40 schrieb David Faure:
> [...]
> > > Should this not be
> > >
> > > if ( r.startContainer() == r.endContainer() &&
> > >    r.startOffset() == r.endOffset() )
> > >
> > > so that _any_ empty range clears the selection?
> >
> > No, an empty range is not the same as no selection.
> > An empty range is what happens when you start clicking on the document:
> > initially the range is empty, but the start point is set, and you can
> > extend the selection with the mouse. [...]
> 
> For caret mode, I basically elided the notion of "no selection", so that an 
> empty range indeed conincides with "no selection" (put another way: there's 
> always a caret position, even if it doesn't blink). I'd like to keep it that 
> way.

Yes, there's always a caret position, but when it's at (Document,0), nothing
should be selected, right? That's what my patch attempts to fix.

When the range is collapsed but is at another position (a real one, inside the document,
even at the beginning, but then it's on an element, not on the document), then
there is no selection and there is a caret position, we agree.

I guess you meant you were against the change Marc suggested, but not against mine?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list