From 5910898f260aa3c48af45cee33ebe4277ea03b6d Mon Sep 17 00:00:00 2001 From: Chulheon Date: Thu, 11 Jul 2013 16:27:35 +0900 Subject: [PATCH] fixed bug (N_SE-38599) Change-Id: I2e3e09ef4fe3a90b73caff82ca4b6d38a4dd738a --- src/ui/controls/FUiCtrl_EditPresenter.cpp | 80 +++++-------------------------- src/ui/inc/FUiCtrl_EditPresenter.h | 1 - 2 files changed, 12 insertions(+), 69 deletions(-) diff --git a/src/ui/controls/FUiCtrl_EditPresenter.cpp b/src/ui/controls/FUiCtrl_EditPresenter.cpp index 3c178fd..c876fcb 100755 --- a/src/ui/controls/FUiCtrl_EditPresenter.cpp +++ b/src/ui/controls/FUiCtrl_EditPresenter.cpp @@ -4155,7 +4155,14 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) __pTextString->GetCharAt(firstTextIndex+textLength - 1, ch); if (ch == L'\n') { - SetCursorPosition(firstTextIndex+textLength - 1); + if (textLength == 0) + { + SetCursorPosition(firstTextIndex); + } + else + { + SetCursorPosition(firstTextIndex+textLength - 1); + } } else { @@ -4336,71 +4343,6 @@ _EditPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo) return false; } -bool -_EditPresenter::TranslateKeyEventInfo(const _Control& source, _KeyInfo& keyInfo) -{ - _KeyCode keyCode = keyInfo.GetKeyCode(); - if (keyInfo.GetKeyModifier() & _KEY_MODIFIER_SHIFT || keyInfo.GetKeyModifier() & _KEY_MODIFIER_CTRL) - { - return false; - } - if ((keyInfo.GetKeyModifier() & _KEY_LOCK_NUM) && ((_KEY_NUMPAD_8 == keyCode || _KEY_NUMPAD_2 == keyCode || _KEY_NUMPAD_6 == keyCode || _KEY_NUMPAD_4 == keyCode))) - { - return false; - } - if (__isUSBKeyboardConnected && (_KEY_UP == keyCode || _KEY_NUMPAD_8 == keyCode || _KEY_DOWN == keyCode || _KEY_NUMPAD_2 == keyCode - || _KEY_RIGHT == keyCode || _KEY_NUMPAD_6 == keyCode || _KEY_LEFT == keyCode || _KEY_NUMPAD_4 == keyCode || _KEY_ENTER == keyCode)) - { - if (__isCopyPasteManagerExist) - { - InitializeCopyPasteManager(); - } - - FinishTextComposition(); - - int curCursorLine = __pTextObject->GetLineIndexAtTextIndex(__pTextObject->GetCursorIndex()); - int totalLine = __pTextObject->GetTotalLineCount(); - if(_KEY_UP == keyCode || _KEY_NUMPAD_8 == keyCode) - { - if (curCursorLine == 0 || GetTextLength() == 0) - { - keyInfo.SetKeyCode(_KEY_TAB); - keyInfo.SetKeyModifier(KEY_MODIFIER_SHIFT); - } - } - else if ( _KEY_DOWN == keyCode || _KEY_NUMPAD_2 == keyCode) - { - if (curCursorLine == (totalLine - 1)) - { - keyInfo.SetKeyCode(_KEY_TAB); - } - } - else if (_KEY_RIGHT == keyCode || _KEY_NUMPAD_6 == keyCode) - { - if (__cursorPos == GetTextLength()) - { - keyInfo.SetKeyCode(_KEY_TAB); - } - } - else if (_KEY_LEFT == keyCode || _KEY_NUMPAD_4 == keyCode) - { - if (__cursorPos == 0) - { - keyInfo.SetKeyCode(_KEY_TAB); - keyInfo.SetKeyModifier(KEY_MODIFIER_SHIFT); - } - } - else if (_KEY_ENTER == keyCode) - { - if(__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE) - { - keyInfo.SetKeyCode(_KEY_TAB); - } - } - } - return false; -} - void _EditPresenter::OnClipboardPopupClosed(const ClipboardItem* pClipboardItem) { @@ -4957,6 +4899,8 @@ _EditPresenter::PasteText(void) ReplaceTextIntoPasswordHyphenString(); + ScrollPanelToCursorPosition(); + __pEdit->SendTextEvent(CORE_TEXT_EVENT_CHANGED); return r; @@ -10839,7 +10783,7 @@ _EditPresenter::SetBlockRangeWithShiftArrowkey(_KeyCode keyCode) int textLength = __pTextObject->GetTextLengthAt(curCursorLine-1); if (offset > textLength) { - start = firstTextIndex+textLength; + start = firstTextIndex+textLength-1; } SetBlockRange(start, end); } @@ -10991,7 +10935,7 @@ _EditPresenter::SetBlockRangeWithShiftArrowkey(_KeyCode keyCode) int textLength = __pTextObject->GetTextLengthAt(curCursorLine-1); if (offset > textLength) { - start = firstTextIndex+textLength; + start = firstTextIndex+textLength -1; } end = __cursorPos; SetBlockRange(start, end); diff --git a/src/ui/inc/FUiCtrl_EditPresenter.h b/src/ui/inc/FUiCtrl_EditPresenter.h index f87b931..5918155 100755 --- a/src/ui/inc/FUiCtrl_EditPresenter.h +++ b/src/ui/inc/FUiCtrl_EditPresenter.h @@ -134,7 +134,6 @@ public: virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo); virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo); virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo); - virtual bool TranslateKeyEventInfo(const _Control& source, _KeyInfo& keyInfo); virtual void OnClipboardPopupClosed(const ClipboardItem* pClipboardItem); virtual result SetInitialBounds(void); -- 2.7.4