aboutsummaryrefslogtreecommitdiff
path: root/src/win
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-12-28 23:05:06 +0800
committercrupest <crupest@outlook.com>2020-12-28 23:05:06 +0800
commit7b6ca6e8a158868da316351b64e64ab1cdb5872c (patch)
tree29b9e58a396d43008fbb27fc6176ac1ed74d7e97 /src/win
parentfb280cc30e1012e18b47e43f783ddd4b33bf9d1c (diff)
downloadcru-7b6ca6e8a158868da316351b64e64ab1cdb5872c.tar.gz
cru-7b6ca6e8a158868da316351b64e64ab1cdb5872c.tar.bz2
cru-7b6ca6e8a158868da316351b64e64ab1cdb5872c.zip
...
Diffstat (limited to 'src/win')
-rw-r--r--src/win/gui/InputMethod.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/win/gui/InputMethod.cpp b/src/win/gui/InputMethod.cpp
index 6643ea58..cc237e88 100644
--- a/src/win/gui/InputMethod.cpp
+++ b/src/win/gui/InputMethod.cpp
@@ -226,7 +226,7 @@ void WinInputMethodContext::OnWindowNativeMessage(
const auto& message = args.GetWindowMessage();
switch (message.msg) {
case WM_CHAR: {
- const auto c = static_cast<char16_t>(message.w_param);
+ auto c = static_cast<char16_t>(message.w_param);
if (IsUtf16SurrogatePairCodeUnit(c)) {
// I don't think this will happen because normal key strike without ime
// should only trigger ascci character. If it is a charater from
@@ -235,8 +235,12 @@ void WinInputMethodContext::OnWindowNativeMessage(
u"A WM_CHAR message for character from supplementary "
u"planes is ignored.");
} else {
- char16_t s[1] = {c};
- text_event_.Raise({s, 1});
+ if (c != '\b') { // ignore backspace
+ if (c == '\r') c = '\n'; // Change \r to \n
+
+ char16_t s[1] = {c};
+ text_event_.Raise({s, 1});
+ }
}
args.HandleWithResult(0);
break;