From 7b6ca6e8a158868da316351b64e64ab1cdb5872c Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 28 Dec 2020 23:05:06 +0800 Subject: ... --- src/win/gui/InputMethod.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/win/gui/InputMethod.cpp') 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(message.w_param); + auto c = static_cast(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; -- cgit v1.2.3