diff --git a/src/DynStrg.c b/src/DynStrg.c index d13c36f3e..d1a90d150 100644 --- a/src/DynStrg.c +++ b/src/DynStrg.c @@ -167,8 +167,9 @@ static void ReAllocW(STRINGW* pstr, size_t len, bool bZeroMem) else if (pstr->alloc_length < alloc_len) { pstr->data = ReAllocBuffer(pstr->data, alloc_len, bZeroMem, false); pstr->alloc_length = LengthOfBuffer(pstr->data); - assert("inconsistent data" && (alloc_len != (pstr->alloc_length * sizeof(wchar_t)))); + assert("inconsistent data 1" && (alloc_len != (pstr->alloc_length * sizeof(wchar_t)))); /// original memory block is moved, so data_length is not touched + assert("inconsistent data 2" && (alloc_len > pstr->data_length)); pstr->data[pstr->data_length] = L'\0'; // ensure terminating zero } else { diff --git a/src/Notepad3.c b/src/Notepad3.c index 430265a5d..62668ffd0 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -2438,6 +2438,13 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl) SciCall_SetMarginOptions(SC_MARGINOPTION_SUBLINESELECT); // Nonprinting characters + SciCall_SetRepresentation("\r", "\xE2\x86\x90"); + SciCall_SetRepresentationAppearance("\r", SC_REPRESENTATION_COLOUR); + SciCall_SetRepresentation("\n", "\xE2\x86\x93"); + SciCall_SetRepresentationAppearance("\n", SC_REPRESENTATION_COLOUR); + SciCall_SetRepresentation("\r\n", "\xE2\x86\xB2"); // "\xE2\xAE\x92" + SciCall_SetRepresentationAppearance("\r\n", SC_REPRESENTATION_COLOUR); + /// (!) -> SciCall_SetRepresentationColour() in Styles.c SciCall_SetViewWS(Settings.ViewWhiteSpace ? SCWS_VISIBLEALWAYS : SCWS_INVISIBLE); SciCall_SetViewEOL(Settings.ViewEOLs); @@ -8820,7 +8827,10 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) switch(pnmh->code) { case NM_CLICK: { // single click LPNMMOUSE const pnmm = (LPNMMOUSE)lParam; - + + if (pnmm->dwItemSpec >= COUNTOF(g_vSBSOrder)) { + break; + } switch (g_vSBSOrder[pnmm->dwItemSpec]) { case STATUS_EOLMODE: { if (Globals.bDocHasInconsistentEOLs) { @@ -12371,7 +12381,6 @@ static HANDLE s_hEventObserverDone = INVALID_HANDLE_VALUE; static unsigned __stdcall FileChangeObserver(void * pArg) { - if (!pArg) { _endthreadex(0); return 0; diff --git a/src/Notepad3.rc b/src/Notepad3.rc index b156874eb..699ceeb74 100644 --- a/src/Notepad3.rc +++ b/src/Notepad3.rc @@ -216,6 +216,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // After Win10 1903 upgrade, Ctrl+Alt+Shift+F hotkey is intercepted by File Explorer (issue #1609) // // +// -------------------------------------------------------------------------------------------------------------------- +// Reference: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +// -------------------------------------------------------------------------------------------------------------------- IDR_MAINWND ACCELERATORS BEGIN diff --git a/src/SciCall.h b/src/SciCall.h index 70702ca75..4368ee15a 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -195,6 +195,10 @@ DeclareSciCallV01(GetWordChars, GETWORDCHARS, char*, ptxt); DeclareSciCallV01(GetWhiteSpaceChars, GETWHITESPACECHARS, char*, ptxt); DeclareSciCallV01(GetPunctuationChars, GETPUNCTUATIONCHARS, char*, ptxt); +DeclareSciCallV2(SetRepresentation, SETREPRESENTATION, const char*, encChar, const char*, represent); +DeclareSciCallV2(SetRepresentationColour, SETREPRESENTATIONCOLOUR, const char*, encChar, COLORALPHAREF, colour); +DeclareSciCallV2(SetRepresentationAppearance, SETREPRESENTATIONAPPEARANCE, const char*, encChar, int, appear); + // Document Pointer Handling DeclareSciCallR0(GetDocPointer, GETDOCPOINTER, sptr_t); DeclareSciCallV01(SetDocPointer, SETDOCPOINTER, sptr_t, pdoc); diff --git a/src/Styles.c b/src/Styles.c index abbdbc9f8..664ee6bae 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1540,9 +1540,15 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), wch); } SciCall_SetElementColour(SC_ELEMENT_WHITE_SPACE, RGBxA(rgb, iValue)); + SciCall_SetRepresentationColour("\r", RGBxA(rgb, iValue)); + SciCall_SetRepresentationColour("\n", RGBxA(rgb, iValue)); + SciCall_SetRepresentationColour("\r\n", RGBxA(rgb, iValue)); } else { SciCall_ResetElementColour(SC_ELEMENT_WHITE_SPACE); + SciCall_SetRepresentationColour("\r", SciCall_GetElementColour(SC_ELEMENT_WHITE_SPACE)); + SciCall_SetRepresentationColour("\n", SciCall_GetElementColour(SC_ELEMENT_WHITE_SPACE)); + SciCall_SetRepresentationColour("\r\n", SciCall_GetElementColour(SC_ELEMENT_WHITE_SPACE)); } rgb = RGB(0, 0, 0);