aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2005-02-17 23:33:42 +0000
committernyamatongwe <unknown>2005-02-17 23:33:42 +0000
commite1b861333d7e28af7bd358536afefd5e834d2e7b (patch)
tree0f489c7cd0cebee20f28cf310952691c10457afa
parent94487f5454e3bab705d63ba015b1172a21c6c469 (diff)
downloadscintilla-mirror-e1b861333d7e28af7bd358536afefd5e834d2e7b.tar.gz
Bug 1131503 patch applied to improve handling of Japanese Katakana
characters.
-rw-r--r--win32/ScintillaWin.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 85b81d309..817f15adb 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -204,7 +204,7 @@ class ScintillaWin :
void ImeStartComposition();
void ImeEndComposition();
- void AddCharBytes(char b0, char b1=0);
+ void AddCharBytes(char b0, char b1);
void GetIntelliMouseParameters();
virtual void CopyToClipboard(const SelectionText &selectedText);
@@ -704,12 +704,12 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
//unsigned int len = UTF8Length(wcs, 1);
//UTF8FromUCS2(wcs, 1, utfval, len);
//AddCharUTF(utfval, len);
- AddCharBytes(static_cast<char>(wParam & 0xff));
+ AddCharBytes('\0', LOBYTE(wParam));
} else {
- AddChar(static_cast<char>(wParam & 0xff));
+ AddChar(LOBYTE(wParam));
}
}
- return 1;
+ return 0;
case WM_UNICHAR:
if (wParam == UNICODE_NOCHAR) {
@@ -810,10 +810,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return HandleComposition(wParam, lParam);
case WM_IME_CHAR: {
- if (HIBYTE(wParam) == '\0')
- AddChar(LOBYTE(wParam));
- else
- AddCharBytes(HIBYTE(wParam), LOBYTE(wParam));
+ AddCharBytes(HIBYTE(wParam), LOBYTE(wParam));
return 0;
}
@@ -1671,23 +1668,29 @@ void ScintillaWin::AddCharBytes(char b0, char b1) {
if (inputCodePage && IsUnicodeMode()) {
char utfval[4]="\0\0\0";
char ansiChars[3];
- ansiChars[0] = b0;
- ansiChars[1] = b1;
- ansiChars[2] = '\0';
wchar_t wcs[2];
- ::MultiByteToWideChar(inputCodePage, 0, ansiChars, 2, wcs, 1);
+ if (b0) { // Two bytes from IME
+ ansiChars[0] = b0;
+ ansiChars[1] = b1;
+ ansiChars[2] = '\0';
+ ::MultiByteToWideChar(inputCodePage, 0, ansiChars, 2, wcs, 1);
+ } else {
+ ansiChars[0] = b1;
+ ansiChars[1] = '\0';
+ ::MultiByteToWideChar(inputCodePage, 0, ansiChars, 1, wcs, 1);
+ }
unsigned int len = UTF8Length(wcs, 1);
UTF8FromUCS2(wcs, 1, utfval, len);
utfval[len] = '\0';
AddCharUTF(utfval,len);
- } else if (b1) {
+ } else if (b0) {
char dbcsChars[3];
dbcsChars[0] = b0;
dbcsChars[1] = b1;
dbcsChars[2] = '\0';
AddCharUTF(dbcsChars, 2, true);
} else {
- AddChar(b0);
+ AddChar(b1);
}
}