From 5ee10423d237c5bd22b8db6fe6d7b53edd0906dc Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 27 Apr 2018 21:10:57 +0000 Subject: 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 Reviewed-by: dsinclair Reviewed-by: Ryan Harrison --- xfa/fwl/cfwl_edit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 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': -- cgit v1.2.3