summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-25 17:52:31 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-25 17:52:31 +0000
commit306b9a87090ba4c4cc8453ef04f230620e224fe0 (patch)
tree5bb9a80a0ecd74801349576e8e75b28f6d9c0fd9 /xfa/fwl/cfwl_edit.cpp
parentf8ffc048195bd96ee58a1aeefcae2ac3f8950ed8 (diff)
downloadpdfium-306b9a87090ba4c4cc8453ef04f230620e224fe0.tar.xz
Fix behavior of Delete key in XFA edit.
Delete had two issues: it acted as a backspace that did not move the caret; delete was considered a valid char to insert in the character buffer. Bug: chromium:820104 Change-Id: I869eedcbf369b9b1df79f16285d991b8e630cd05 Reviewed-on: https://pdfium-review.googlesource.com/31291 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 871aa3c6bf..afa9aac87d 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1224,10 +1224,7 @@ void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) {
break;
}
- if (m_CursorPosition > 0) {
- SetCursorPosition(m_EdtEngine.GetIndexBefore(m_CursorPosition));
- m_EdtEngine.Delete(m_CursorPosition, 1);
- }
+ m_EdtEngine.Delete(m_CursorPosition, 1);
break;
}
case FWL_VKEY_Insert:
@@ -1253,20 +1250,21 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode);
switch (c) {
- case FWL_VKEY_Back:
+ case L'\b':
if (m_CursorPosition > 0) {
SetCursorPosition(m_EdtEngine.GetIndexBefore(m_CursorPosition));
m_EdtEngine.Delete(m_CursorPosition, 1);
}
break;
- case FWL_VKEY_NewLine:
- case FWL_VKEY_Escape:
+ case L'\n':
+ case 27: // Esc
+ case 127: // Delete
break;
- case FWL_VKEY_Tab:
+ case L'\t':
m_EdtEngine.Insert(m_CursorPosition, L"\t");
SetCursorPosition(m_CursorPosition + 1);
break;
- case FWL_VKEY_Return:
+ case L'\r':
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_WantReturn) {
m_EdtEngine.Insert(m_CursorPosition, L"\n");
SetCursorPosition(m_CursorPosition + 1);