diff --git a/Versions/build.txt b/Versions/build.txt index 43a79d255..7c024ac6d 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -1695 +1697 diff --git a/language/np3_zh_cn/menu_zh_cn.rc b/language/np3_zh_cn/menu_zh_cn.rc index 482488e72..d4aaf7fea 100644 --- a/language/np3_zh_cn/menu_zh_cn.rc +++ b/language/np3_zh_cn/menu_zh_cn.rc @@ -340,7 +340,7 @@ BEGIN MENUITEM "代码折叠(&F)\tCtrl+Shift+Alt+F", IDM_VIEW_FOLDING MENUITEM "切换折叠(&T)\tCtrl+Shift+F", IDM_VIEW_TOGGLEFOLDS MENUITEM "切换聚焦(&V)\tCtrl+Alt+V", IDM_VIEW_TOGGLE_VIEW - MENUITEM "&Monitoring Log", IDM_VIEW_CHASING_DOCTAIL + MENUITEM "日志监控(&M)", IDM_VIEW_CHASING_DOCTAIL MENUITEM "允许滚动超过文件尾(&F)", IDM_VIEW_SCROLLPASTEOF END POPUP "工具栏(&T)" diff --git a/language/np3_zh_cn/strings_zh_cn.rc b/language/np3_zh_cn/strings_zh_cn.rc index 04834966e..d7fec23fb 100644 --- a/language/np3_zh_cn/strings_zh_cn.rc +++ b/language/np3_zh_cn/strings_zh_cn.rc @@ -89,7 +89,7 @@ STRINGTABLE BEGIN IDT_FILE_LAUNCH "运行当前文档" IDT_VIEW_TOGGLE_VIEW "仅显示匹配行" - IDT_VIEW_CHASING_DOCTAIL "Monitoring Log" + IDT_VIEW_CHASING_DOCTAIL "日志监控" END STRINGTABLE diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index be9e401d4..046b5c774 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 RC diff --git a/scintilla/lexers/LexLaTeX.cxx b/scintilla/lexers/LexLaTeX.cxx index 63e1f8c62..930c8173b 100644 --- a/scintilla/lexers/LexLaTeX.cxx +++ b/scintilla/lexers/LexLaTeX.cxx @@ -40,6 +40,13 @@ struct latexFoldSave { latexFoldSave(const latexFoldSave &save) : structLev(save.structLev) { for (int i = 0; i < 8; ++i) openBegins[i] = save.openBegins[i]; } + latexFoldSave &operator=(const latexFoldSave &save) { + if (this != &save) { + structLev = save.structLev; + for (int i = 0; i < 8; ++i) openBegins[i] = save.openBegins[i]; + } + return *this; + } int openBegins[8]; Sci_Position structLev; }; diff --git a/scintilla/win32/HanjaDic.cxx b/scintilla/win32/HanjaDic.cxx index b55b91d8c..805fc3641 100644 --- a/scintilla/win32/HanjaDic.cxx +++ b/scintilla/win32/HanjaDic.cxx @@ -65,10 +65,10 @@ private: public: IHanjaDic *HJinterface; - HanjaDic() : HJinterface(NULL) { + HanjaDic() : HJinterface(nullptr) { hr = CLSIDFromProgID(OLESTR("mshjdic.hanjadic"), &CLSID_HanjaDic); if (SUCCEEDED(hr)) { - hr = CoCreateInstance(CLSID_HanjaDic, NULL, + hr = CoCreateInstance(CLSID_HanjaDic, nullptr, CLSCTX_INPROC_SERVER, IID_IHanjaDic, (LPVOID *)& HJinterface); if (SUCCEEDED(hr)) { diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 0144fd529..4107d9802 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -98,7 +98,7 @@ bool LoadD2D() { // A single threaded factory as Scintilla always draw on the GUI thread fnD2DCF(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), - 0, + nullptr, reinterpret_cast(&pD2DFactory)); } } @@ -605,7 +605,7 @@ int SurfaceGDI::DeviceHeightFont(int points) { } void SurfaceGDI::MoveTo(int x_, int y_) { - ::MoveToEx(hdc, x_, y_, 0); + ::MoveToEx(hdc, x_, y_, nullptr); } void SurfaceGDI::LineTo(int x_, int y_) { @@ -2216,7 +2216,7 @@ void Window::Show(bool show) { } void Window::InvalidateAll() { - ::InvalidateRect(HwndFromWindowID(wid), NULL, FALSE); + ::InvalidateRect(HwndFromWindowID(wid), nullptr, FALSE); } void Window::InvalidateRectangle(PRectangle rc) { @@ -2799,7 +2799,7 @@ POINT ListBoxX::MaxTrackSize() const { void ListBoxX::SetRedraw(bool on) { ::SendMessage(lb, WM_SETREDRAW, on, 0); if (on) - ::InvalidateRect(lb, NULL, TRUE); + ::InvalidateRect(lb, nullptr, TRUE); } void ListBoxX::ResizeToCursor() { @@ -3198,22 +3198,17 @@ LRESULT PASCAL ListBoxX::StaticWndProc( namespace { bool ListBoxX_Register() noexcept { - WNDCLASSEX wndclassc; + WNDCLASSEX wndclassc {}; wndclassc.cbSize = sizeof(wndclassc); // We need CS_HREDRAW and CS_VREDRAW because of the ellipsis that might be drawn for // truncated items in the list and the appearance/disappearance of the vertical scroll bar. // The list repaint is double-buffered to avoid the flicker this would otherwise cause. wndclassc.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; - wndclassc.cbClsExtra = 0; wndclassc.cbWndExtra = sizeof(ListBoxX *); wndclassc.hInstance = hinstPlatformRes; - wndclassc.hIcon = NULL; - wndclassc.hbrBackground = NULL; - wndclassc.lpszMenuName = NULL; wndclassc.lpfnWndProc = ListBoxX::StaticWndProc; wndclassc.hCursor = ::LoadCursor(NULL, IDC_ARROW); wndclassc.lpszClassName = ListBoxX_ClassName; - wndclassc.hIconSm = 0; return ::RegisterClassEx(&wndclassc) != 0; } diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 3e813d9d4..9a56eb05e 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -3435,7 +3435,7 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) noexcept { // Register the Scintilla class // Register Scintilla as a wide character window - WNDCLASSEXW wndclass; + WNDCLASSEXW wndclass {}; wndclass.cbSize = sizeof(wndclass); wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = ScintillaWin::SWndProc; @@ -3453,7 +3453,7 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) noexcept { if (result) { // Register the CallTip class - WNDCLASSEX wndclassc; + WNDCLASSEX wndclassc {}; wndclassc.cbSize = sizeof(wndclassc); wndclassc.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; wndclassc.cbClsExtra = 0; diff --git a/src/Edit.c b/src/Edit.c index 772cb4330..d69b8cc28 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -394,9 +394,9 @@ bool EditConvertText(HWND hwnd, cpi_enc_t encSource, cpi_enc_t encDest, bool bSe struct Sci_TextRange tr = { { 0, -1 }, NULL }; tr.lpstrText = pchText; - SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); + DocPos const rlength = SciCall_GetTextRange(&tr); - const DocPos wchBufSize = length * 3 + 2; + const DocPos wchBufSize = rlength * 3 + 2; WCHAR* pwchText = AllocMem(wchBufSize, HEAP_ZERO_MEMORY); // MultiBytes(Sci) -> WideChar(destination) -> Sci(MultiByte) @@ -410,6 +410,7 @@ bool EditConvertText(HWND hwnd, cpi_enc_t encSource, cpi_enc_t encDest, bool bSe cbwText = MultiByteToWideChar(cpDst, 0, pchText, cbText, pwchText, (MBWC_DocPos_Cast)wchBufSize); // convert to Scintilla format cbText = WideCharToMultiByte(Encoding_SciCP, 0, pwchText, cbwText, pchText, (MBWC_DocPos_Cast)chBufSize, NULL, NULL); + pchText[cbText] = '\0'; pchText[cbText+1] = '\0'; @@ -4554,6 +4555,8 @@ void EditFixPositions(HWND hwnd) // void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt) { + UNUSED(hwnd); + const DocPos iCurPos = SciCall_GetCurrentPos(); const DocPos iAnchorPos = SciCall_GetAnchor(); @@ -4583,8 +4586,8 @@ void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt) if (pszText && pszTextW) { tr.lpstrText = pszText; - SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); - MultiByteToWideChar(Encoding_SciCP,0,pszText,(MBWC_DocPos_Cast)len,pszTextW,(MBWC_DocPos_Cast)len); + DocPos const rlen = SciCall_GetTextRange(&tr); + MultiByteToWideChar(Encoding_SciCP,0,pszText,(MBWC_DocPos_Cast)rlen,pszTextW,(MBWC_DocPos_Cast)len); for (WCHAR* p = pszTextW; *p && cch < COUNTOF(tch)-1; p++) { if (*p == L'\r' || *p == L'\n' || *p == L'\t' || *p == L' ') { diff --git a/src/Notepad3.c b/src/Notepad3.c index b75cbb490..a87c25b87 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -9771,8 +9771,8 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, // the .LOG feature ... if (SciCall_GetTextLength() >= 4) { - char tchLog[6] = { '\0','\0','\0','\0','\0','\0' }; - SciCall_GetText(5, tchLog); + char tchLog[5] = { '\0','\0','\0','\0','\0' }; + SciCall_GetText(COUNTOF(tchLog), tchLog); if (StringCchCompareXA(tchLog,".LOG") == 0) { EditJumpTo(Globals.hwndEdit,-1,0); _BEGIN_UNDO_ACTION_; @@ -9891,8 +9891,8 @@ bool FileRevert(LPCWSTR szFileName, bool bIgnoreCmdLnEnc) } else if (SciCall_GetTextLength() >= 4) { - char tch[6] = { '\0','\0','\0','\0','\0','\0' }; - SciCall_GetText(5, tch); + char tch[5] = { '\0','\0','\0','\0','\0' }; + SciCall_GetText(COUNTOF(tch), tch); if (StringCchCompareXA(tch,".LOG") != 0) { SciCall_ClearSelections(); //~EditSetSelectionEx(Globals.hwndEdit, iAnchorPos, iCurPos, vSpcAnchorPos, vSpcCaretPos); @@ -10005,14 +10005,15 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy) bool bIsEmptyNewFile = false; if (StringCchLenW(Globals.CurrentFile, COUNTOF(Globals.CurrentFile)) == 0) { - const DocPos cchText = SciCall_GetTextLength(); - if (cchText == 0) + DocPos const cchText = SciCall_GetTextLength(); + if (cchText == 0) { bIsEmptyNewFile = true; - else if (cchText < 1023) { - char chTextBuf[1024] = { '\0' }; - SciCall_GetText(1023, chTextBuf); + } + else if (cchText < 2048) { + char chTextBuf[2048] = { '\0' }; + SciCall_GetText(COUNTOF(chTextBuf), chTextBuf); StrTrimA(chTextBuf, " \t\n\r"); - if (StringCchLenA(chTextBuf, COUNTOF(chTextBuf)) == 0) { + if (StrIsEmptyA(chTextBuf)) { bIsEmptyNewFile = true; } } diff --git a/src/SciCall.h b/src/SciCall.h index f3ce11a76..ad90c783d 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -201,6 +201,8 @@ DeclareSciCallV0(Cancel, CANCEL) DeclareSciCallV0(CopyAllowLine, COPYALLOWLINE) DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, const char*, text) DeclareSciCallV2(GetText, GETTEXT, DocPos, length, const char*, text) +DeclareSciCallR01(GetTextRange, GETTEXTRANGE, DocPos, struct Sci_TextRange*, textrange) + DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos) DeclareSciCallV0(SelectAll, SELECTALL) diff --git a/src/Styles.c b/src/Styles.c index d1ca45561..7c1ddd0a8 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1799,8 +1799,8 @@ void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) if (!Flags.NoCGIGuess && (StringCchCompareNI(wchMode,COUNTOF(wchMode),L"cgi", CSTRLEN(L"cgi")) == 0 || StringCchCompareNI(wchMode,COUNTOF(wchMode),L"fcgi", CSTRLEN(L"fcgi")) == 0)) { - char tchText[256] = { L'\0' }; - SciCall_GetText(COUNTOF(tchText) - 1, tchText); + char tchText[256] = { '\0' }; + SciCall_GetText(COUNTOF(tchText), tchText); StrTrimA(tchText," \t\n\r"); pLexSniffed = Style_SniffShebang(tchText); if (pLexSniffed) { @@ -1837,7 +1837,7 @@ void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) if (!Flags.NoCGIGuess && (StringCchCompareXI(lpszExt,L"cgi") == 0 || StringCchCompareXI(lpszExt,L"fcgi") == 0)) { char tchText[256] = { '\0' }; - SciCall_GetText(COUNTOF(tchText) - 1, tchText); + SciCall_GetText(COUNTOF(tchText), tchText); StrTrimA(tchText," \t\n\r"); pLexSniffed = Style_SniffShebang(tchText); if (pLexSniffed) { @@ -1880,8 +1880,8 @@ void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) } if (!bFound && s_bAutoSelect && (!Flags.NoHTMLGuess || !Flags.NoCGIGuess)) { - char tchText[512]; - SciCall_GetText(COUNTOF(tchText) - 1, tchText); + char tchText[512] = { '\0' }; + SciCall_GetText(COUNTOF(tchText), tchText); StrTrimA(tchText," \t\n\r"); if (!Flags.NoCGIGuess) { if (tchText[0] == '<') { diff --git a/src/VersionEx.h b/src/VersionEx.h index e1928a92c..8f48bab52 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -7,8 +7,8 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 19 -#define VERSION_REV 506 -#define VERSION_BUILD 1695 +#define VERSION_REV 510 +#define VERSION_BUILD 1697 #define SCINTILLA_VER 415+ #define ONIGMO_REGEX_VER 6.2.0 #define VERSION_PATCH RC