diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 1b116edcfa..369a7ed345 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -5749,9 +5749,10 @@ Sci::Position Editor::GetTag(char *tagValue, int tagNumber) { return length; } -Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view text) { +Sci::Position Editor::ReplaceTarget(Message iMessage, uptr_t wParam, sptr_t lParam) { + std::string_view text = ViewFromParams(lParam, wParam); const UndoGroup ug(pdoc); - if (replaceType == ReplaceType::patterns) { + if (iMessage == Message::ReplaceTargetRE) { Sci::Position length = text.length(); const char *p = pdoc->SubstituteByPosition(text.data(), &length); if (!p) { @@ -5760,7 +5761,7 @@ Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view te text = std::string_view(p, length); } - if (replaceType == ReplaceType::minimal) { + if (iMessage == Message::ReplaceTargetMinimal) { // Check for prefix and suffix and reduce text and target to match. // This is performed with Range which doesn't support virtual space. Range range(targetRange.start.Position(), targetRange.end.Position()); @@ -6311,16 +6312,10 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { } case Message::ReplaceTarget: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::basic, ViewFromParams(lParam, wParam)); - case Message::ReplaceTargetRE: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::patterns, ViewFromParams(lParam, wParam)); - case Message::ReplaceTargetMinimal: PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::minimal, ViewFromParams(lParam, wParam)); + return ReplaceTarget(iMessage, wParam, lParam); case Message::SearchInTarget: PLATFORM_ASSERT(lParam); diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 71c62c42cb..70b5241e63 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -605,8 +605,7 @@ class Editor : public EditModel, public DocWatcher { void FoldAll(Scintilla::FoldAction action); Sci::Position GetTag(char *tagValue, int tagNumber); - enum class ReplaceType {basic, patterns, minimal}; - Sci::Position ReplaceTarget(ReplaceType replaceType, std::string_view text); + Sci::Position ReplaceTarget(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam); bool PositionIsHotspot(Sci::Position position) const noexcept; bool SCICALL PointIsHotspot(Point pt); diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index 5349e82c1d..bdbab48861 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -441,7 +441,7 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f const bool posix = FlagSet(flags, FindOption::Posix); char *mp = nfa; /* nfa pointer */ char *sp = nfa; /* another one */ - const char *mpMax = mp + MAXNFA - BITBLK - 10; + const char * const mpMax = mp + MAXNFA - BITBLK - 10; int tagstk[MAXTAG]{}; /* subpat tag stack */ int tagi = 0; /* tag stack index */ diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index ee850f75ea..76b668b4a8 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -1433,7 +1433,7 @@ bool ScintillaWin::HandleLaTeXTabCompletion() { targetRange.start.SetPosition(pos); targetRange.end.SetPosition(main); - ReplaceTarget(ReplaceType::basic, std::string_view(buffer, len)); + ReplaceTarget(Message::ReplaceTarget, len, reinterpret_cast(buffer)); // move caret after character SetEmptySelection(pos + len); return true;