diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-04-27 21:10:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-27 21:10:57 +0000 |
commit | 5ee10423d237c5bd22b8db6fe6d7b53edd0906dc (patch) | |
tree | 6d18497746c4913e1e7fc9522919a03a86366e9a | |
parent | 724f61671bec82f521be75b0ace069fb3130902a (diff) | |
download | pdfium-5ee10423d237c5bd22b8db6fe6d7b53edd0906dc.tar.xz |
Update caret after changes that could move lines in XFA edit.
This fixes issues when a line break is deleted and the caret remains
where it was, now between two lines.
Bug: chromium:836361
Change-Id: I6cd40402a97348bcfc4c9291e7acb044a1e68113
Reviewed-on: https://pdfium-review.googlesource.com/31391
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 8ebc155a80..dd7bcfae3a 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -236,7 +236,9 @@ Optional<WideString> CFWL_Edit::Cut() { if (!m_EdtEngine.HasSelection()) return {}; - return {m_EdtEngine.DeleteSelectedText()}; + WideString cut_text = m_EdtEngine.DeleteSelectedText(); + UpdateCaret(); + return {cut_text}; } bool CFWL_Edit::Paste(const WideString& wsPaste) { @@ -1225,6 +1227,7 @@ void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { } m_EdtEngine.Delete(m_CursorPosition, 1); + UpdateCaret(); break; } case FWL_VKEY_Insert: @@ -1254,6 +1257,7 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { if (m_CursorPosition > 0) { SetCursorPosition(m_CursorPosition - 1); m_EdtEngine.Delete(m_CursorPosition, 1); + UpdateCaret(); } break; case L'\n': |