From 33faa03a8dda5f6d95c4e36b6cf654c0db283c55 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 30 Aug 2018 15:55:54 +0200 Subject: [PATCH] + fix: minor bug fixes and IME changes --- minipath/src/minipath.c | 4 ++-- scintilla/win32/ScintillaWin.cxx | 6 +++--- src/Edit.c | 11 ++++++----- src/Notepad3.c | 31 +++++++++++++++++-------------- src/SciCall.h | 10 ++++++++++ 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/minipath/src/minipath.c b/minipath/src/minipath.c index d9dcc76d1..0ec2d15b6 100644 --- a/minipath/src/minipath.c +++ b/minipath/src/minipath.c @@ -881,7 +881,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) else if (iCmd == IDM_TRAY_EXIT) { ShowNotifyIcon(hwnd,FALSE); - SendMessage(hwnd,WM_CLOSE,0,0); + PostMessage(hwnd,WM_CLOSE,0,0); } } return TRUE; @@ -2194,7 +2194,7 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam) else if (iEscFunction == 1) SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0); else if (iEscFunction == 2) - SendMessage(hwnd,WM_CLOSE,0,0); + PostMessage(hwnd,WM_CLOSE,0,0); break; diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index b22c823f4..51ca1248a 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -1679,7 +1679,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam break; case WM_IME_STARTCOMPOSITION: // dbcs - if (KoreanIME() || imeInteraction == imeInline) { + if (imeInteraction == imeInline) { return 0; } else { ImeStartComposition(); @@ -1691,7 +1691,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); case WM_IME_COMPOSITION: - if (KoreanIME() || imeInteraction == imeInline) { + if (imeInteraction == imeInline) { return HandleCompositionInline(wParam, lParam); } else { return HandleCompositionWindowed(wParam, lParam); @@ -1730,7 +1730,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam return 0; case WM_IME_SETCONTEXT: - if (KoreanIME() || imeInteraction == imeInline) { + if (imeInteraction == imeInline) { if (wParam) { LPARAM NoImeWin = lParam; NoImeWin = NoImeWin & (~ISC_SHOWUICOMPOSITIONWINDOW); diff --git a/src/Edit.c b/src/Edit.c index 924e3b72d..d8b134871 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -6682,11 +6682,12 @@ void EditCompleteWord(HWND hwnd, bool autoInsert) LocalFree(t); } SendMessage(hwnd, SCI_AUTOCSETIGNORECASE, 1, 0); - //SendMessage(hwnd, SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE, 1, 0); - SendMessage(hwnd, SCI_AUTOCSETSEPARATOR, ' ', 0); - SendMessage(hwnd, SCI_AUTOCSETFILLUPS, 0, (LPARAM)"\t\n\r"); - SendMessage(hwnd, SCI_AUTOCSETCHOOSESINGLE, autoInsert, 0); - SendMessage(hwnd, SCI_AUTOCSHOW, iRootLen, (LPARAM)(pList + 1)); + SciCall_AutoCSetIgnoreCase(true); + //SendMessage(hwnd, SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, (WPARAM)SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE, 0); + SciCall_AutoCSetSeperator(' '); + SciCall_AutoCSetFillups("\t\n\r"); + SciCall_AutoCSetChooseSingle(autoInsert); + SciCall_AutoCShow(iRootLen, (pList + 1)); LocalFree(pList); } } diff --git a/src/Notepad3.c b/src/Notepad3.c index 394083093..a43a62ee6 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -2689,10 +2689,9 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) RestoreWndFromTray(hwnd); ShowOwnedPopups(hwnd, true); } - else if (iCmd == IDM_TRAY_EXIT) { //ShowNotifyIcon(hwnd,false); - SendMessage(hwnd, WM_CLOSE, 0, 0); + PostMessage(hwnd, WM_CLOSE, 0, 0); } } break; @@ -3336,7 +3335,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_FILE_EXIT: - SendMessage(hwnd,WM_CLOSE,0,0); + PostMessage(hwnd,WM_CLOSE,0,0); break; @@ -4749,8 +4748,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_VIEW_AUTOCOMPLETEWORDS: g_bAutoCompleteWords = (g_bAutoCompleteWords) ? false : true; // toggle - if (!g_bAutoCompleteWords) - SendMessage(g_hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list + if (!g_bAutoCompleteWords) { + SciCall_AutoCCancel(); // close the auto completion list + } break; case IDM_VIEW_ACCELWORDNAV: @@ -5159,18 +5159,21 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case CMD_ESCAPE: //close the autocomplete box - SendMessage(g_hwndEdit,SCI_AUTOCCANCEL,0, 0); + SciCall_AutoCCancel(); - if (iEscFunction == 1) - SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0); - else if (iEscFunction == 2) - SendMessage(hwnd,WM_CLOSE,0,0); + if (iEscFunction == 1) { + SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + } + else if (iEscFunction == 2) { + PostMessage(hwnd, WM_CLOSE, 0, 0); + } break; case CMD_SHIFTESC: - if (FileSave(true,false,false,false)) - SendMessage(hwnd,WM_CLOSE,0,0); + if (FileSave(true, false, false, false)) { + PostMessage(hwnd, WM_CLOSE, 0, 0); + } break; @@ -5782,7 +5785,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDT_FILE_EXIT: - SendMessage(hwnd,WM_CLOSE,0,0); + PostMessage(hwnd,WM_CLOSE,0,0); break; @@ -6321,7 +6324,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) else if (scn->ch == '?') { _HandleTinyExpr(); } - else if (g_bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) { + else if (g_bAutoCompleteWords && !SciCall_AutoCActive() && !_IsInlineIMEActive()) { EditCompleteWord(g_hwndEdit, false); } } diff --git a/src/SciCall.h b/src/SciCall.h index 05298b8db..6b4c4589f 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -246,6 +246,16 @@ DeclareSciCallR2(GetCurLine, GETCURLINE, DocPos, unsigned int, length, const cha DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options) +DeclareSciCallR0(AutoCActive, AUTOCACTIVE, bool) +DeclareSciCallV0(AutoCComplete, AUTOCCOMPLETE) +DeclareSciCallV0(AutoCCancel, AUTOCCANCEL) +DeclareSciCallV1(AutoCSetIgnoreCase, AUTOCSETIGNORECASE, bool, flag) +DeclareSciCallV1(AutoCSetSeperator, AUTOCSETSEPARATOR, char, seperator) +DeclareSciCallV01(AutoCSetFillups, AUTOCSETFILLUPS, const char*, text) +DeclareSciCallV1(AutoCSetChooseSingle, AUTOCSETCHOOSESINGLE, bool, flag) +DeclareSciCallV2(AutoCShow, AUTOCSHOW, int, len, const char*, list) + + //============================================================================= // // Commands