From ab3909796cf2e9fa192040bcd7cb9da7bb3328a5 Mon Sep 17 00:00:00 2001 From: Diana Gage Date: Fri, 28 Jul 2017 17:07:39 -0700 Subject: Add FORM_ReplaceSelection() and embedder tests. This method replaces the selected text in a user-editable form text area with another text string (which can be empty or non-empty). If there is no selected text, FORM_ReplaceSelection() will append the replacement text after the current caret position. BUG=chromium:59266 Change-Id: I76448ef757d107888c33ebd5656457ebac93b952 Reviewed-on: https://pdfium-review.googlesource.com/8812 Reviewed-by: Lei Zhang Commit-Queue: Diana Gage --- fpdfsdk/pwl/cpwl_edit_ctrl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'fpdfsdk/pwl/cpwl_edit_ctrl.cpp') diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp index a852cb6231..1a7b0e4c49 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp @@ -59,9 +59,12 @@ CFX_WideString CPWL_EditCtrl::GetSelectedText() { return CFX_WideString(); } -void CPWL_EditCtrl::DeleteSelectedText() { - if (m_pEdit) - m_pEdit->ClearSelection(); +void CPWL_EditCtrl::ReplaceSelection(const CFX_WideString& text) { + if (!m_pEdit) + return; + + m_pEdit->ClearSelection(); + m_pEdit->InsertText(text, FX_CHARSET_Default); } void CPWL_EditCtrl::RePosChildWnd() { -- cgit v1.2.3