--Boundary-00=_7nnx96HA9OSwOUc Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Description: clearsigned data Content-Disposition: inline -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 04 November 2002 13:41, Andras Mantia wrote: > Hi, > > Now I'm really wondering that without any Klipper running, if I select a part > of a message in KMail (when reading mails, not composing) _with_ the mouse > and try to paste it somewhere (eg KDevelop) with MMB then it pastes some old > text from the clipboard and not the current selected from PRIMARY (as I > expected). Of course, pressing CTRL-C after I select the text works. Bug or > feature? I think it's a bug and it shouldn't behave this way. Klipper running or not doesn't matter - its configuration affects KClipboard, used by all apps; so make sure it's set to "separate selection and clipboard". What you describe sounds like a bug in KHTML I fixed recently, where the text selection code would sometimes fail - and therefore didn't copy the selection. How uptodate is your khtml? Does updating it help? I also have a further patch to improve text selection, but it got no review yet, except "it looks messy" by Dirk :). It does, but not that much. The point is to detect when the mouse is "above everything" (in the top margin) or "below everything" (in the unused area below the HTML). See attachment. I doubt it helps for your specific problem though, unless it's about selecting the very beginning or very end of the message. - -- David FAURE, david@mandrakesoft.com, faure@kde.org http://people.mandrakesoft.com/~david/ Contributing to: http://www.konqueror.org/, http://www.koffice.org/ Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9xnn772KcVAmwbhARAmigAJ9pknAF9dyqPHsrguYGDlRRbhF4zgCghb30 pfIQ1asw1Rz0w2rV52eVInA= =pc+M -----END PGP SIGNATURE----- --Boundary-00=_7nnx96HA9OSwOUc Content-Type: text/x-diff; charset="iso-8859-1"; name="render_object.cpp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="render_object.cpp.diff" Index: render_object.cpp =================================================================== RCS file: /home/kde/kdelibs/khtml/rendering/render_object.cpp,v retrieving revision 1.194 diff -u -p -r1.194 render_object.cpp --- render_object.cpp 2002/10/30 18:23:12 1.194 +++ render_object.cpp 2002/10/31 00:04:07 @@ -26,6 +26,7 @@ #include "rendering/render_object.h" #include "rendering/render_table.h" #include "rendering/render_list.h" +#include "rendering/render_text.h" #include "rendering/render_root.h" #include "xml/dom_elementimpl.h" #include "misc/htmlhashes.h" @@ -848,9 +849,47 @@ FindSelectionResult RenderObject::checkS return r->checkSelectionPoint( _x, _y, _tx, _ty, node, offset ); } } - //kdDebug(6030) << "nodeAtPoint Failed. Fallback - hmm, SelectionPointAfter" << endl; - node = 0; - offset = 0; + // nodeAtPoint failed. + // We need to check if we are before or after this object, to fallback correctly. + int tx = _tx + xPos(); + int ty = _ty + yPos(); + if (isRelPositioned()) + static_cast(this)->relativePositionOffset(tx, ty); + //kdDebug(6030) << this << " nodeAtPoint failed. _y= " << _y << " _ty=" << _ty << endl; + + if (_y <= ty || ( _y >= ty && _y < ty+height() && _x <= tx ) ) + { + // iterate down if element()==0 (rare case) + RenderObject* obj = this; + node = obj->element(); + while ( !node && obj ) { + obj = obj->objectBelow(); + node = obj->element(); + } + offset = 0; + //kdDebug(6030) << this << " nodeAtPoint failed. Fallback: SelectionPointBefore node=" << node << endl; + return SelectionPointBefore; + } + + //kdDebug(6030) << this << " nodeAtPoint failed. Fallback: SelectionPointAfter" << endl; + // After everything, i.e. after the end of the last object + RenderObject* obj = this; + RenderObject* last = obj->lastChild(); + while ( last ) { + obj = last; + last = last->lastChild(); + } + node = obj->element(); + // iterate up if element()==0 (rare case) + while ( !node && obj ) { + obj = obj->objectAbove(); + node = obj->element(); + } + if ( obj && obj->isText() ) + offset = static_cast(obj)->data().length(); + else + offset = 0; + //kdDebug(6030) << "obj=" << obj << " node=" << node << " offset=" << offset << endl; return SelectionPointAfter; } --Boundary-00=_7nnx96HA9OSwOUc--