From 9f41b18165ebdfcdd0f82c80fa4f646ca9f4ccd1 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 27 Apr 2019 15:55:10 +0200 Subject: [PATCH 1/5] + fix: repair Hyperlink styling, broken by last commit --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Notepad3.c | 10 ++++++++-- src/Notepad3.h | 2 +- src/Styles.c | 1 + src/VersionEx.h | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 89fd6869c..9b5365173 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -1676 +1677 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 77c2ea7c9..47451ea2c 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 develop diff --git a/src/Notepad3.c b/src/Notepad3.c index b7263a24c..6cac92cab 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -260,6 +260,8 @@ void ObserveNotifyChangeEvent() InterlockedDecrement(&iNotifyChangeStackCounter); } if (CheckNotifyChangeEvent()) { + EditApplyVisibleStyle(); + //~!recursion!~EditUpdateVisibleUrlHotspot(Settings.HyperlinkHotspot); UpdateAllBars(false); } } @@ -1322,6 +1324,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) // update Scintilla colors case WM_SYSCOLORCHANGE: + Sci_ApplyStyle(0, -1); MarkAllOccurrences(0, true); UpdateVisibleUrlHotspot(0); UpdateAllBars(false); @@ -2276,6 +2279,7 @@ LRESULT MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) SendWMSize(hwnd, rc); UpdateUI(); + Sci_ApplyStyle(0, -1); UpdateAllBars(false); return 0; @@ -2343,6 +2347,7 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam) EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); UpdateUI(); + Sci_ApplyStyle(0, -1); UpdateAllBars(false); return 0; @@ -9197,7 +9202,7 @@ void UpdateUI() scn.nmhdr.hwndFrom = Globals.hwndEdit; scn.nmhdr.idFrom = IDC_EDIT; scn.nmhdr.code = SCN_UPDATEUI; - scn.updated = (SC_UPDATE_CONTENT | SC_UPDATE_NP3_INTERNAL_NOTIFY); + scn.updated = (SC_UPDATE_CONTENT/* | SC_UPDATE_NP3_INTERNAL_NOTIFY */); SendMessage(Globals.hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); //PostMessage(Globals.hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); Sci_ApplyStyle(0, -1); @@ -9759,8 +9764,9 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, //bReadOnly = false; _SetSaveNeededFlag(false); + Sci_ApplyStyle(0, -1); UpdateVisibleUrlHotspot(0); - UpdateAllBars(false); + UpdateAllBars(true); // consistent settings file handling (if loaded in editor) s_bEnableSaveSettings = (StringCchCompareNIW(Globals.CurrentFile, COUNTOF(Globals.CurrentFile), Globals.IniFile, COUNTOF(Globals.IniFile)) == 0) ? false : true; diff --git a/src/Notepad3.h b/src/Notepad3.h index e18d95684..d81cb8efa 100644 --- a/src/Notepad3.h +++ b/src/Notepad3.h @@ -144,7 +144,7 @@ void UpdateStatusbar(bool); void UpdateMarginWidth(); void UpdateSettingsCmds(); void UpdateVisibleUrlHotspot(int delay); -inline void UpdateAllBars(bool force) { UpdateToolbar(); UpdateStatusbar(force); UpdateMarginWidth(); Sci_ApplyStyle(0,-1); } +inline void UpdateAllBars(bool force) { UpdateToolbar(); UpdateStatusbar(force); UpdateMarginWidth(); } void UndoRedoRecordingStart(); void UndoRedoRecordingStop(); diff --git a/src/Styles.c b/src/Styles.c index 2f45fa5fe..81c560563 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1310,6 +1310,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) Style_SetInvisible(hwnd, false); // set fixed invisible style // apply lexer styles + Sci_ApplyStyle(0, -1); Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot); EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot); diff --git a/src/VersionEx.h b/src/VersionEx.h index 5c7e31656..b58e5a67f 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 427 -#define VERSION_BUILD 1676 +#define VERSION_BUILD 1677 #define SCINTILLA_VER 415 #define ONIGMO_REGEX_VER 6.2.0 #define VERSION_PATCH develop From 60dd43941bda1f9cdf26689d4bef3c990e15a30b Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 27 Apr 2019 16:50:52 +0200 Subject: [PATCH 2/5] + fix: previuos commit --- src/Edit.c | 15 ++++++++++----- src/Notepad3.c | 15 +++++++-------- src/Styles.c | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index 2ae3e8d19..2bd284fcf 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -6149,11 +6149,7 @@ void EditUpdateVisibleUrlHotspot(bool bEnabled) DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1)); _IGNORE_NOTIFY_CHANGE_; - _ENTER_TARGET_TRANSACTION_; - EditUpdateUrlHotspots(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), bEnabled); - - _LEAVE_TARGET_TRANSACTION_; _OBSERVE_NOTIFY_CHANGE_; } } @@ -6166,7 +6162,12 @@ void EditApplyVisibleStyle() { DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1)); - Sci_ApplyStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine)); + if (Settings.HyperlinkHotspot && !_IsInTargetTransaction()) { + EditUpdateUrlHotspots(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), true); + } + else { + Sci_ApplyStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine)); + } } @@ -6871,6 +6872,8 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi // 1st apply current lexer style EditFinalizeStyling(startPos); + _ENTER_TARGET_TRANSACTION_; + DocPos start = startPos; DocPos end = endPos; do { @@ -6897,6 +6900,8 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi } while (start < end); + _LEAVE_TARGET_TRANSACTION_; + SciCall_StartStyling(endPos); } diff --git a/src/Notepad3.c b/src/Notepad3.c index 6cac92cab..5d67518c3 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -260,8 +260,8 @@ void ObserveNotifyChangeEvent() InterlockedDecrement(&iNotifyChangeStackCounter); } if (CheckNotifyChangeEvent()) { - EditApplyVisibleStyle(); - //~!recursion!~EditUpdateVisibleUrlHotspot(Settings.HyperlinkHotspot); + EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); + EditFinalizeStyling(-1); UpdateAllBars(false); } } @@ -1324,9 +1324,9 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) // update Scintilla colors case WM_SYSCOLORCHANGE: - Sci_ApplyStyle(0, -1); MarkAllOccurrences(0, true); - UpdateVisibleUrlHotspot(0); + EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); + EditFinalizeStyling(-1); UpdateAllBars(false); return DefWindowProc(hwnd,umsg,wParam,lParam); @@ -2279,7 +2279,8 @@ LRESULT MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) SendWMSize(hwnd, rc); UpdateUI(); - Sci_ApplyStyle(0, -1); + EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); + EditFinalizeStyling(-1); UpdateAllBars(false); return 0; @@ -2345,9 +2346,8 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam) } MarkAllOccurrences(0, true); EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); - + EditFinalizeStyling(-1); UpdateUI(); - Sci_ApplyStyle(0, -1); UpdateAllBars(false); return 0; @@ -9205,7 +9205,6 @@ void UpdateUI() scn.updated = (SC_UPDATE_CONTENT/* | SC_UPDATE_NP3_INTERNAL_NOTIFY */); SendMessage(Globals.hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); //PostMessage(Globals.hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn); - Sci_ApplyStyle(0, -1); COND_SHOW_ZOOM_CALLTIP(); } diff --git a/src/Styles.c b/src/Styles.c index 81c560563..a47a428f1 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1310,9 +1310,9 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) Style_SetInvisible(hwnd, false); // set fixed invisible style // apply lexer styles - Sci_ApplyStyle(0, -1); Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot); EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot); + EditFinalizeStyling(-1); UpdateAllBars(false); } From ba1ac6f56a5afb8f97a741b80d8d9739419bced7 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 27 Apr 2019 22:33:59 +0200 Subject: [PATCH 3/5] + chg: allow Hyperlink Hotspots to be activated in "Focused View" --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Edit.c | 102 +++++++++++++++------------------ src/Edit.h | 4 +- src/Notepad3.c | 30 ++++------ src/Styles.c | 18 +++--- src/TypeDefs.h | 1 + src/VersionEx.h | 2 +- 8 files changed, 74 insertions(+), 87 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 9b5365173..5a9a9ee2f 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -1677 +1678 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 47451ea2c..5e1f27d01 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 develop diff --git a/src/Edit.c b/src/Edit.c index 2bd284fcf..5e6b608ec 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -316,9 +316,7 @@ void _ClearTextBuffer(HWND hwnd) if (SciCall_GetReadOnly()) { SciCall_SetReadOnly(false); } EditClearAllOccurrenceMarkers(); - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); - } + if (Globals.bHideNonMatchedLines) { EditToggleView(hwnd); } SendMessage(hwnd, SCI_CLEARALL, 0, 0); SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_BOOKMARK, 0); @@ -4428,7 +4426,7 @@ void EditSetSelectionEx(HWND hwnd, DocPos iAnchorPos, DocPos iCurrentPos, DocPos // remember x-pos for moving caret vertically SciCall_ChooseCaretX(); - EditApplyVisibleStyle(); + EditApplyVisibleStyle(hwnd); UpdateToolbar(); UpdateStatusbar(false); @@ -5261,9 +5259,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara Globals.iReplacedOccurrences = 0; Globals.FindReplaceMatchFoundState = FND_NOP; - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); - } + if (Globals.bHideNonMatchedLines) { EditToggleView(hwnd); } MarkAllOccurrences(50, true); if (s_InitialTopLine >= 0) { @@ -5456,7 +5452,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara if (sg_pefrData->bMarkOccurences) { if (sg_pefrData->bStateChanged || (StringCchCompareXA(s_lastFind, sg_pefrData->szFind) != 0)) { _IGNORE_NOTIFY_CHANGE_; - if (EditToggleView(Globals.hwndEdit, false)) { _DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK); } + if (Globals.bHideNonMatchedLines) { _DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK); } StringCchCopyA(s_lastFind, COUNTOF(s_lastFind), sg_pefrData->szFind); RegExResult_t match = _FindHasMatch(Globals.hwndEdit, sg_pefrData, 0, (sg_pefrData->bMarkOccurences), false); if (s_anyMatch != match) { s_anyMatch = match; } @@ -5480,7 +5476,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara } } _OBSERVE_NOTIFY_CHANGE_; - if (EditToggleView(Globals.hwndEdit, false)) { EditHideNotMarkedLineRange(Globals.hwndEdit, -1, -1, true); } + if (Globals.bHideNonMatchedLines) { EditHideNotMarkedLineRange(Globals.hwndEdit, 0, -1, true); } } } else { @@ -5512,7 +5508,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara Settings.MarkOccurrencesMatchVisible = bSaveOccVisible; //DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible); DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false); - if (EditToggleView(Globals.hwndEdit, false)) { + if (Globals.bHideNonMatchedLines) { PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_TOGGLE_VISIBILITY, 1), 0); } InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); @@ -5527,15 +5523,15 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara case IDC_TOGGLE_VISIBILITY: - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); + if (Globals.bHideNonMatchedLines) { + EditToggleView(hwnd); sg_pefrData->bStateChanged = true; s_InitialTopLine = -1; EditClearAllOccurrenceMarkers(); _DelayMarkAll(hwnd, 0, s_InitialSearchStart); } else { - EditToggleView(Globals.hwndEdit, true); + EditToggleView(hwnd); } break; @@ -6158,20 +6154,19 @@ void EditUpdateVisibleUrlHotspot(bool bEnabled) // // EditApplyVisibleStyle() // -void EditApplyVisibleStyle() +void EditApplyVisibleStyle(HWND hwnd) { DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1)); if (Settings.HyperlinkHotspot && !_IsInTargetTransaction()) { - EditUpdateUrlHotspots(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), true); + EditUpdateUrlHotspots(hwnd, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), true); } - else { + else if (!Globals.bHideNonMatchedLines) { Sci_ApplyStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine)); } } - //============================================================================= // // _GetReplaceString() @@ -6469,50 +6464,40 @@ void EditClearAllOccurrenceMarkers() // // EditToggleView() // -bool EditToggleView(HWND hwnd, bool bToggleView) +void EditToggleView(HWND hwnd) { - UNUSED(hwnd); - static bool bHideNonMatchedLines = false; - if (bToggleView) - { - bool const bWaitCursor = ((Globals.iMarkOccurrencesCount > 1000) || (SciCall_GetLineCount() > 2000)) ? true : false; - static bool bSaveHyperlinkHotspots = false; - static bool bSaveFoldingAvailable = false; - static bool bSaveShowFolding = false; - if (bWaitCursor) { BeginWaitCursor(NULL); } - _IGNORE_NOTIFY_CHANGE_; - if (!bHideNonMatchedLines) { - bSaveFoldingAvailable = Globals.bCodeFoldingAvailable; - bSaveShowFolding = Settings.ShowCodeFolding; - bSaveHyperlinkHotspots = Settings.HyperlinkHotspot; - Settings.HyperlinkHotspot = false; - } - else { - Globals.bCodeFoldingAvailable = bSaveFoldingAvailable; - Settings.ShowCodeFolding = bSaveShowFolding; - Settings.HyperlinkHotspot = bSaveHyperlinkHotspots; - } - EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_HYPERLINKHOTSPOTS, Settings.HyperlinkHotspot); + static bool bSaveFoldingAvailable = false; + static bool bSaveShowFolding = false; - bHideNonMatchedLines = bHideNonMatchedLines ? false : true; // toggle + bool const bWaitCursor = ((Globals.iMarkOccurrencesCount > 1000) || (SciCall_GetLineCount() > 2000)) ? true : false; + if (bWaitCursor) { BeginWaitCursor(NULL); } + _IGNORE_NOTIFY_CHANGE_; - EditHideNotMarkedLineRange(hwnd, -1, -1, bHideNonMatchedLines); - - if (bHideNonMatchedLines) { - EditScrollTo(hwnd, 0, false); - SciCall_SetReadOnly(true); - } - else { - EditScrollTo(hwnd, Sci_GetCurrentLineNumber(), true); - SciCall_SetReadOnly(false); - } - - _OBSERVE_NOTIFY_CHANGE_; - if (bWaitCursor) { EndWaitCursor(); } + if (!Globals.bHideNonMatchedLines) { + bSaveFoldingAvailable = Globals.bCodeFoldingAvailable; + bSaveShowFolding = Settings.ShowCodeFolding; + } + else { + Globals.bCodeFoldingAvailable = bSaveFoldingAvailable; + Settings.ShowCodeFolding = bSaveShowFolding; } - return bHideNonMatchedLines; -} + Globals.bHideNonMatchedLines = !Globals.bHideNonMatchedLines; // toggle + + EditHideNotMarkedLineRange(hwnd, 0, -1, Globals.bHideNonMatchedLines); + + if (Globals.bHideNonMatchedLines) { + EditScrollTo(hwnd, 0, false); + SciCall_SetReadOnly(true); + } + else { + EditScrollTo(hwnd, Sci_GetCurrentLineNumber(), true); + SciCall_SetReadOnly(false); + } + + _OBSERVE_NOTIFY_CHANGE_; + if (bWaitCursor) { EndWaitCursor(); } +} //============================================================================= @@ -6906,6 +6891,7 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi } + //============================================================================= // // EditHideNotMarkedLineRange() @@ -6932,8 +6918,10 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo for (DocLn iLine = 0; iLine < iLnCount; ++iLine) { SciCall_SetFoldLevel(iLine, SC_FOLDLEVELBASE); } SciCall_SetFoldFlags(0); Style_SetFolding(hwnd, Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding); - Sci_ApplyStyle(0, -1); SciCall_FoldAll(EXPAND); + Sci_ApplyStyle(0, -1); + EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot); + EditFinalizeStyling(-1); } else // ===== hide lines without marker ===== { diff --git a/src/Edit.h b/src/Edit.h index c3cdcec82..4c771f468 100644 --- a/src/Edit.h +++ b/src/Edit.h @@ -99,7 +99,7 @@ void EditPrintSetup(HWND); void EditPrintInit(); void EditMatchBrace(HWND hwnd); void EditClearAllOccurrenceMarkers(); -bool EditToggleView(HWND hwnd, bool bToggleView); +void EditToggleView(HWND hwnd); void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd, bool, bool); void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool); void EditSetAccelWordNav(HWND hwnd,bool); @@ -110,7 +110,7 @@ void EditSetBookmarkList(HWND hwnd,LPCWSTR pszBookMarks); void EditFinalizeStyling(DocPos iEndPos); void EditMarkAllOccurrences(HWND hwnd, bool bForceClear); void EditUpdateVisibleUrlHotspot(bool); -void EditApplyVisibleStyle(); +void EditApplyVisibleStyle(HWND hwnd); void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, bool); diff --git a/src/Notepad3.c b/src/Notepad3.c index 5d67518c3..788ef133e 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -484,6 +484,7 @@ static void _InitGlobals() Globals.bIniFileFromScratch = false; Globals.bFindReplCopySelOrClip = true; Globals.bReplaceInitialized = false; + Globals.bHideNonMatchedLines = false; Globals.FindReplaceMatchFoundState = FND_NOP; Flags.bDevDebugMode = DefaultFlags.bDevDebugMode = false; @@ -2341,9 +2342,7 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam) SendWMSize(hwnd, NULL); - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); - } + if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); } MarkAllOccurrences(0, true); EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot); EditFinalizeStyling(-1); @@ -3019,7 +3018,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, Settings.MarkOccurrencesMatchCase); EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible); - CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, EditToggleView(Globals.hwndEdit, false)); + CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, Globals.bHideNonMatchedLines); if (Settings.MarkOccurrencesMatchWholeWords) { i = IDM_VIEW_MARKOCCUR_WORD; @@ -4939,14 +4938,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) break; case IDM_VIEW_TOGGLE_VIEW: - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); + if (Globals.bHideNonMatchedLines) { + EditToggleView(Globals.hwndEdit); MarkAllOccurrences(0, true); } else { - EditToggleView(Globals.hwndEdit, true); + EditToggleView(Globals.hwndEdit); } - CheckCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, EditToggleView(Globals.hwndEdit, false)); + CheckCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, Globals.bHideNonMatchedLines); UpdateToolbar(); break; @@ -6465,9 +6464,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) _SetSaveNeededFlag(true); } else if (pnmh->code == SCN_MODIFYATTEMPTRO) { - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); - } + if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); } } } return TRUE; @@ -6569,7 +6566,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) if (Settings.HyperlinkHotspot) { UpdateVisibleUrlHotspot(Settings2.UpdateDelayHyperlinkStyling); } - EditApplyVisibleStyle(); + //@@@~EditApplyVisibleStyle(Globals.hwndEdit); } } break; @@ -8427,7 +8424,7 @@ static void _UpdateToolbarDelayed() bool b1 = SciCall_IsSelectionEmpty(); bool b2 = (bool)(SciCall_GetTextLength() > 0); bool ro = SciCall_GetReadOnly(); - bool tv = EditToggleView(Globals.hwndEdit, false); + bool tv = Globals.bHideNonMatchedLines; EnableTool(IDT_EDIT_UNDO, SciCall_CanUndo() && !ro); EnableTool(IDT_EDIT_REDO, SciCall_CanRedo() && !ro); @@ -9169,7 +9166,7 @@ void UpdateMarginWidth() SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0); } - if (!EditToggleView(Globals.hwndEdit, false)) { + if (!Globals.bHideNonMatchedLines) { Style_SetBookmark(Globals.hwndEdit, Settings.ShowSelectionMargin); Style_SetFolding(Globals.hwndEdit, (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding)); } @@ -9585,9 +9582,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, fioStatus.iEncoding = CPI_ANSI_DEFAULT; if (bNew || bReload) { - if (EditToggleView(Globals.hwndEdit, false)) { - EditToggleView(Globals.hwndEdit, true); - } + if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); } } if (!bDontSave) @@ -9763,7 +9758,6 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload, //bReadOnly = false; _SetSaveNeededFlag(false); - Sci_ApplyStyle(0, -1); UpdateVisibleUrlHotspot(0); UpdateAllBars(true); diff --git a/src/Styles.c b/src/Styles.c index a47a428f1..8bc9d6a80 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1308,9 +1308,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) } Style_SetInvisible(hwnd, false); // set fixed invisible style + Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot); // apply lexer styles - Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot); + Sci_ApplyStyle(0, -1); EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot); EditFinalizeStyling(-1); @@ -1861,14 +1862,17 @@ void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile) void Style_SetLexerFromName(HWND hwnd,LPCWSTR lpszFile,LPCWSTR lpszName) { PEDITLEXER pLexNew = Style_MatchLexer(lpszName, false); - if (pLexNew) - Style_SetLexer(hwnd,pLexNew); + if (pLexNew) { + Style_SetLexer(hwnd, pLexNew); + } else { pLexNew = Style_MatchLexer(lpszName, true); - if (pLexNew) + if (pLexNew) { Style_SetLexer(hwnd, pLexNew); - else + } + else { Style_SetLexerFromFile(hwnd, lpszFile); + } } } @@ -1899,7 +1903,7 @@ void Style_SetDefaultLexer(HWND hwnd) // void Style_SetHTMLLexer(HWND hwnd) { - Style_SetLexer(hwnd,Style_MatchLexer(L"Web Source Code",true)); + Style_SetLexer(hwnd,&lexHTML); } @@ -1909,7 +1913,7 @@ void Style_SetHTMLLexer(HWND hwnd) // void Style_SetXMLLexer(HWND hwnd) { - Style_SetLexer(hwnd,Style_MatchLexer(L"XML Document",true)); + Style_SetLexer(hwnd,&lexXML); } diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 28e095b59..76450b3d5 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -308,6 +308,7 @@ typedef struct _globals_t bool bIniFileFromScratch; bool bFindReplCopySelOrClip; bool bReplaceInitialized; + bool bHideNonMatchedLines; FR_STATES FindReplaceMatchFoundState; diff --git a/src/VersionEx.h b/src/VersionEx.h index b58e5a67f..c1dfbed66 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 427 -#define VERSION_BUILD 1677 +#define VERSION_BUILD 1679 #define SCINTILLA_VER 415 #define ONIGMO_REGEX_VER 6.2.0 #define VERSION_PATCH develop From 6eaa92b4276d3ffada4dd429466967e582c5c1a5 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 27 Apr 2019 22:35:31 +0200 Subject: [PATCH 4/5] + chg: build number --- res/Notepad3.exe.manifest.conf | 2 +- src/VersionEx.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 5e1f27d01..60aaec60b 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 develop diff --git a/src/VersionEx.h b/src/VersionEx.h index c1dfbed66..883f687f9 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 427 -#define VERSION_BUILD 1679 +#define VERSION_BUILD 1678 #define SCINTILLA_VER 415 #define ONIGMO_REGEX_VER 6.2.0 #define VERSION_PATCH develop From 4fd1f13c904424d9b7eff6998287b3312e386628 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 27 Apr 2019 22:58:24 +0200 Subject: [PATCH 5/5] + fix: Printer Setup dialog --- src/Print.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Print.cpp b/src/Print.cpp index fb9b88609..5878eb953 100644 --- a/src/Print.cpp +++ b/src/Print.cpp @@ -498,11 +498,11 @@ extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, SendDlgItemMessage(hwnd,1137,CB_SETEXTENDEDUI,true,0); SendDlgItemMessage(hwnd,1138,CB_SETEXTENDEDUI,true,0); } - return true; + break; case WM_DPICHANGED: UpdateWindowLayoutForDPI(hwnd, 0, 0, 0, 0); - return true; + break; case WM_COMMAND: if (LOWORD(wParam) == IDOK) @@ -519,12 +519,12 @@ extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, { PostMessage(hwnd, WM_COMMAND, MAKELONG(1026, 1), 0); } - return true; + break; default: break; } - return false; + return 0; }