diff --git a/src/Edit.c b/src/Edit.c index 4162bb5cc..47a015503 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -5911,7 +5911,7 @@ static DocPos _FindInTarget(LPCWSTR wchFind, int sFlags, DocPos const len = (DocPos)WideCharToMultiByte(Encoding_SciCP, 0, wchFind, -1, chFind, COUNTOF(chFind), NULL, NULL); iPos = SciCall_SearchInTarget(len - 1, chFind); - iPos = (bFindNext ? (iPos >= stop) : (iPos <= stop)) ? -1LL : iPos; // regex search + iPos = (bFindNext ? (iPos > stop) : (iPos < stop)) ? -1LL : iPos; // not found if beyond stop // handle next in case of zero-length-matches (regex) ! if (iPos == start) { diff --git a/src/Notepad3.c b/src/Notepad3.c index e48063852..c7a58b3cf 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -6382,15 +6382,17 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_SET_RENDER_TECH_D2D: case IDM_SET_RENDER_TECH_D2DRETAIN: case IDM_SET_RENDER_TECH_D2DDC: { - int const prevRT = Settings.RenderingTechnology; + int const prevRT = SciCall_GetTechnology(); Settings.RenderingTechnology = (iLoWParam - IDM_SET_RENDER_TECH_GDI); - SciCall_SetTechnology(Settings.RenderingTechnology); - Settings.RenderingTechnology = SciCall_GetTechnology(); - - int const prevBD = Settings.Bidirectional; - SciCall_SetBidirectional(Settings.Bidirectional); - Settings.Bidirectional = SciCall_GetBidirectional(); - + if (prevRT != Settings.RenderingTechnology) { + SciCall_SetTechnology(Settings.RenderingTechnology); + Settings.RenderingTechnology = SciCall_GetTechnology(); // switched ? + } + int const prevBD = SciCall_GetBidirectional(); + if (prevBD != Settings.Bidirectional) { + SciCall_SetBidirectional(Settings.Bidirectional); + Settings.Bidirectional = SciCall_GetBidirectional(); // switched ? + } if ((prevRT != Settings.RenderingTechnology) || (prevBD != Settings.Bidirectional)) { Style_ResetCurrentLexer(Globals.hwndEdit); }