From kde-commits Mon Oct 06 20:17:00 2008 From: Maks Orlovich Date: Mon, 06 Oct 2008 20:17:00 +0000 To: kde-commits Subject: branches/KDE/4.1/kdelibs/khtml Message-Id: <1223324220.806027.21655.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=122332424016497 SVN commit 868642 by orlovich: Fix selection granularity not being initialized, at least when one initially started over a URL or image. M +5 -0 editing/editing_p.h M +5 -5 khtml_part.cpp --- branches/KDE/4.1/kdelibs/khtml/editing/editing_p.h #868641:868642 @@ -53,6 +53,11 @@ bool m_keyReleasePending:1; + void beginSelectingText(DOM::Selection::ETextGranularity granularity) { + m_beganSelectingText = true; + m_selectionGranularity = granularity; + } + int m_xPosForVerticalArrowNavigation; DOM::Editor *m_editor; --- branches/KDE/4.1/kdelibs/khtml/khtml_part.cpp #868641:868642 @@ -6310,8 +6310,7 @@ } if (selection.state() != Selection::CARET) { - d->editor_context.m_selectionGranularity = Selection::WORD; - d->editor_context.m_beganSelectingText = true; + d->editor_context.beginSelectingText(Selection::WORD); } setCaret(selection); @@ -6335,8 +6334,7 @@ } if (selection.state() != Selection::CARET) { - d->editor_context.m_selectionGranularity = Selection::LINE; - d->editor_context.m_beganSelectingText = true; + d->editor_context.beginSelectingText(Selection::LINE); } setCaret(selection); @@ -6473,7 +6471,9 @@ Selection sel = caret(); sel.clearModifyBias(); if (!d->editor_context.m_beganSelectingText) { - d->editor_context.m_beganSelectingText = true; + // We are beginning a selection during press-drag, when the original click + // wasn't appropriate for one. Make sure to set the granularity. + d->editor_context.beginSelectingText(Selection::CHARACTER); sel.moveTo(pos); }