Fix for setSelection( htmlDocument().createRange() )
David Faure
faure at kde.org
Fri Nov 5 09:40:05 GMT 2004
On Friday 05 November 2004 09:15, Marc Mutz wrote:
> On Friday 05 November 2004 02:36, David Faure wrote:
> <snip>
> > + if ( r.startContainer() == document() && r.endContainer() ==
> > document() && r.startOffset() == 0 && r.endOffset() == 0 )
> > + slotClearSelection();
> <snip>
>
> 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. The DOM Range spec specifies it like that, an
empty range is basically a "cursor" position in the document.
The only problem is with the "cursor" position equal to (Document, 0),
which should mean "no selection".
--
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