From eb57e0d0b396606b39ef76a864b8bf9dd91a8ed8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 6 Sep 2017 11:44:39 -0400 Subject: Implement word selection in CFDE_TextEditEngine This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair Reviewed-by: Ryan Harrison Reviewed-by: Henrique Nakashima --- xfa/fwl/cfwl_edit.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'xfa/fwl/cfwl_edit.cpp') diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 72adb5392b..99a312bfca 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -1234,14 +1234,13 @@ void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) { } void CFWL_Edit::OnButtonDoubleClick(CFWL_MessageMouse* pMsg) { - // TODO(dsinclair): Handle OnButtonDoubleClick - // int32_t nCount = 0; - // int32_t nIndex = pPage->SelectWord(DeviceToEngine(pMsg->m_pos), nCount); - // if (nIndex < 0) - // return; - // - // m_EdtEngine.AddSelRange(nIndex, nCount); - // SetCursorPosition(nIndex + nCount - 1); + size_t click_idx = m_EdtEngine.GetIndexForPoint(DeviceToEngine(pMsg->m_pos)); + size_t start_idx; + size_t end_idx; + std::tie(start_idx, end_idx) = m_EdtEngine.BoundsForWordAt(click_idx); + + m_EdtEngine.SetSelection(start_idx, end_idx); + m_CursorPosition = end_idx; RepaintRect(m_rtEngine); } -- cgit v1.2.3