diff --git a/Versions/build.txt b/Versions/build.txt index f5b23f4df..bec09296c 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2637 +2639 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 39b99217b..15241df9b 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/scintilla/lexlib/WordList.cxx b/scintilla/lexlib/WordList.cxx index c8b4cd63b..6463e89df 100644 --- a/scintilla/lexlib/WordList.cxx +++ b/scintilla/lexlib/WordList.cxx @@ -117,11 +117,25 @@ static void SortWordList(char **words, unsigned int len) { #endif + +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> +constexpr char asciitolower(const char ch) noexcept { + if ((ch >= 'A') && (ch <= 'Z')) { + return (ch - ('Z' - 'z')); + } + return ch; +} +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + + void WordList::Set(const char *s) { Clear(); const size_t lenS = strlen(s) + 1; list = new char[lenS]; - memcpy(list, s, lenS); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + //~memcpy(list, s, lenS); + for (size_t i = 0; i < lenS; ++i) { list[i] = asciitolower(s[i]); } + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< words = ArrayFromWordList(list, &len, onlyLineEnds); #ifdef _MSC_VER std::sort(words, words + len, cmpWords); @@ -140,6 +154,7 @@ void WordList::Set(const char *s) { * Prefix elements start with '^' and match all strings that start with the rest of the element * so '^GTK_' matches 'GTK_X', 'GTK_MAJOR_VERSION', and 'GTK_'. */ + bool WordList::InList(const char *s) const { if (0 == words) return false; diff --git a/src/Notepad3.c b/src/Notepad3.c index 9618ca304..576586f9e 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -895,7 +895,6 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, } _InsertLanguageMenu(Globals.hMainMenu); - Style_InsertThemesMenu(Globals.hMainMenu); if (!InitApplication(Globals.hInstance)) @@ -909,6 +908,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _CleanUpResources(hwnd, true); return 1; } + DrawMenuBar(hwnd); #ifdef _EXTRA_DRAG_N_DROP_HANDLER_ DragAndDropInit(NULL); @@ -1189,6 +1189,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow) } SetMenu(Globals.hwndMain, Globals.hMainMenu); + DrawMenuBar(Globals.hwndMain); // Current file information -- moved in front of ShowWindow() FileLoad(true,true,false,Settings.SkipUnicodeDetection,Settings.SkipANSICodePageDetection,false,L""); @@ -1417,7 +1418,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow) } if (s_flagAppIsClosing || s_flagPrintFileAndLeave) { - PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0); + CloseApplication(); } return(Globals.hwndMain); @@ -1450,6 +1451,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case WM_WINDOWPOSCHANGED: case WM_TIMER: case WM_KILLFOCUS: + case WM_ENTERIDLE: return DefWindowProc(hwnd, umsg, wParam, lParam); // never send @@ -1474,12 +1476,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case WM_CLOSE: s_flagAppIsClosing = true; - if (IsWindow(Globals.hwndDlgFindReplace)) { - PostMessage(Globals.hwndDlgFindReplace, WM_CLOSE, 0, 0); - } - if (IsWindow(Globals.hwndDlgCustomizeSchemes)) { - PostMessage(Globals.hwndDlgCustomizeSchemes, WM_CLOSE, 0, 0); - } + CloseNonModalDialogs(); if (FileSave(false, true, false, false, Flags.bPreserveFileModTime)) { DestroyWindow(hwnd); } @@ -2606,7 +2603,6 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam) Toolbar_GetButtons(Globals.hwndToolbar,IDT_FILE_NEW,Settings.ToolbarButtons,COUNTOF(Settings.ToolbarButtons)); CreateBars(hwnd,hInstance); - SendWMSize(hwnd, NULL); MarkAllOccurrences(0, true); @@ -3034,7 +3030,7 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) } else if (iCmd == IDM_TRAY_EXIT) { //ShowNotifyIcon(hwnd,false); - PostMessage(hwnd, WM_CLOSE, 0, 0); + CloseApplication(); } } break; @@ -3435,12 +3431,7 @@ static void _DynamicLanguageMenuCmd(int cmd) } if (!MUI_LanguageDLLs[iLngIdx].bIsActive) { - if (IsWindow(Globals.hwndDlgFindReplace)) { - PostMessage(Globals.hwndDlgFindReplace, WM_CLOSE, 0, 0); - } - if (IsWindow(Globals.hwndDlgCustomizeSchemes)) { - PostMessage(Globals.hwndDlgCustomizeSchemes, WM_CLOSE, 0, 0); - } + CloseNonModalDialogs(); StringCchCopyW(Settings2.PreferredLanguageLocaleName, COUNTOF(Settings2.PreferredLanguageLocaleName), MUI_LanguageDLLs[iLngIdx].szLocaleName); IniFileSetString(Globals.IniFile, L"Settings2", L"PreferredLanguageLocaleName", Settings2.PreferredLanguageLocaleName); @@ -3452,7 +3443,7 @@ static void _DynamicLanguageMenuCmd(int cmd) Globals.hMainMenu = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_MAINMENU)); if (!Globals.hMainMenu) { GetLastErrorToMsgBox(L"LoadMenu()", 0); - PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0); + CloseApplication(); return; } @@ -3645,7 +3636,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) fioStatus.iEOLMode = SciCall_GetEOLMode(); if (DoElevatedRelaunch(&fioStatus)) { - PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0); + CloseApplication(); } else { InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_ELEVATED_RIGHTS); @@ -3792,7 +3783,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_FILE_EXIT: - PostMessage(hwnd,WM_CLOSE,0,0); + CloseApplication(); break; @@ -5587,7 +5578,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); } else if (Settings.EscFunction == 2) { - PostMessage(hwnd, WM_CLOSE, 0, 0); + CloseApplication(true); } else { if (!SciCall_IsSelectionEmpty()) { @@ -5600,9 +5591,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case CMD_SHIFTESC: - if (FileSave(true, false, false, false, Flags.bPreserveFileModTime)) { - PostMessage(hwnd, WM_CLOSE, 0, 0); - } + CloseApplication(); break; @@ -6267,7 +6256,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDT_FILE_EXIT: - PostMessage(hwnd,WM_CLOSE,0,0); + CloseApplication(); break; @@ -9799,7 +9788,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP { // File or "Untitled" ... WCHAR tch[MAX_PATH] = { L'\0' }; - if (StringCchLenW(Globals.CurrentFile, COUNTOF(Globals.CurrentFile))) { + if (StrIsNotEmpty(Globals.CurrentFile)) { StringCchCopy(tch, COUNTOF(tch), Globals.CurrentFile); } else { @@ -9907,7 +9896,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP if ((IDOK == answer) || (IDYES == answer)) { if (DoElevatedRelaunch(&fioStatus)) { - PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0); + CloseApplication(); } else { s_flagAppIsClosing = false; @@ -10403,7 +10392,8 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode) if (GetDoAnimateMinimize()) { DrawAnimatedRects(hWindow, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition); } SetWindowPlacement(hWindow, &wndpl); } - SetWindowPos(hWindow, (Settings.AlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, fPrevFlags); + SetWindowPos(hWindow, NULL, 0, 0, 0, 0, fPrevFlags); + SetWindowPos(hWindow, (Settings.AlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); s_bPrevFullScreenFlag = false; } else { // full screen mode @@ -10421,7 +10411,8 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode) Settings.ShowToolbar = Settings.ShowStatusbar = false; s_bPrevFullScreenFlag = true; } - //SetMenu(Globals.hwndMain, NULL); + + DrawMenuBar(Globals.hwndMain); MsgThemeChanged(hWindow, (WPARAM)NULL, (LPARAM)NULL); } @@ -10658,7 +10649,6 @@ void CALLBACK WatchTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) // // PasteBoardTimer() // -// void CALLBACK PasteBoardTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) { if ((s_dwLastCopyTime > 0) && ((GetTickCount() - s_dwLastCopyTime) > 200)) { @@ -10687,4 +10677,31 @@ void CALLBACK PasteBoardTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) UNUSED(hwnd); } + +//============================================================================= +// +// CloseNonModalDialogs() +// +void CloseNonModalDialogs() +{ + if (IsWindow(Globals.hwndDlgFindReplace)) { + PostMessage(Globals.hwndDlgFindReplace, WM_CLOSE, 0, 0); + } + if (IsWindow(Globals.hwndDlgCustomizeSchemes)) { + PostMessage(Globals.hwndDlgCustomizeSchemes, WM_CLOSE, 0, 0); + } +} + + +//============================================================================= +// +// CloseApplication() +// +void CloseApplication() +{ + CloseNonModalDialogs(); + PostMessage(Globals.hwndMain, WM_CLOSE, 0, 0); +} + + /// End of Notepad3.c /// diff --git a/src/Notepad3.h b/src/Notepad3.h index 9a2c0fb0a..6535b835e 100644 --- a/src/Notepad3.h +++ b/src/Notepad3.h @@ -179,6 +179,8 @@ bool OpenFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir) bool SaveFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir); void CreateBars(HWND hwnd, HINSTANCE hInstance); +void CloseNonModalDialogs(); +void CloseApplication(); LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam); LRESULT MsgCreate(HWND hwnd, WPARAM wParam, LPARAM lParam); diff --git a/src/StyleLexers/styleLexAHKL.c b/src/StyleLexers/styleLexAHKL.c index 052b5b856..c65932664 100644 --- a/src/StyleLexers/styleLexAHKL.c +++ b/src/StyleLexers/styleLexAHKL.c @@ -98,7 +98,7 @@ KEYWORDLIST KeyWords_AHKL = { "A_WinDir A_WorkingDir A_YDay A_YEAR A_YWeek A_YYYY Clipboard ClipboardAll ComSpec ErrorLevel " "ProgramFiles true false", // Keyboard & Mouse Keys -"^ + ! # ~ $ ` Shift LShift RShift Alt LAlt RAlt Control LControl RControl Ctrl LCtrl RCtrl " +"Shift LShift RShift Alt LAlt RAlt Control LControl RControl Ctrl LCtrl RCtrl " "LWin RWin AppsKey AltDown AltUp ShiftDown ShiftUp CtrlDown CtrlUp LWinDown LWinUp RWinDown " "RWinUp LButton RButton MButton WheelUp WheelDown XButton1 XButton2 Joy1 Joy2 Joy3 Joy4 Joy5 " "Joy6 Joy7 Joy8 Joy9 Joy10 Joy11 Joy12 Joy13 Joy14 Joy15 Joy16 Joy17 Joy18 Joy19 Joy20 Joy21 " diff --git a/src/VersionEx.h b/src/VersionEx.h index 29cc190cb..2ad2d4157 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 916 -#define VERSION_BUILD 2637 +#define VERSION_BUILD 2639 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 #define UCHARDET_VER 2018.09.27