From cb8cd73d839a96f98bb1ce887c694271f9c24788 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 22 Nov 2022 09:24:07 +1100 Subject: Add SCI_REPLACETARGETMINIMAL to change text without causing unchanged prefix and suffix to be marked as modified in change history. --- src/Editor.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Editor.h') diff --git a/src/Editor.h b/src/Editor.h index 128abf234..85d95e21d 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -581,7 +581,8 @@ protected: // ScintillaBase subclass needs access to much of Editor void FoldAll(Scintilla::FoldAction action); Sci::Position GetTag(char *tagValue, int tagNumber); - Sci::Position ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length=-1); + enum class ReplaceType {basic, patterns, minimal}; + Sci::Position ReplaceTarget(ReplaceType replaceType, std::string_view text); bool PositionIsHotspot(Sci::Position position) const noexcept; bool PointIsHotspot(Point pt); @@ -625,6 +626,12 @@ protected: // ScintillaBase subclass needs access to much of Editor static unsigned char *UCharPtrFromSPtr(Scintilla::sptr_t lParam) noexcept { return static_cast(PtrFromSPtr(lParam)); } + static std::string_view ViewFromParams(Scintilla::sptr_t lParam, Scintilla::uptr_t wParam) noexcept { + if (SPtrFromUPtr(wParam) == -1) { + return std::string_view(CharPtrFromSPtr(lParam)); + } + return std::string_view(CharPtrFromSPtr(lParam), wParam); + } static void *PtrFromUPtr(Scintilla::uptr_t wParam) noexcept { return reinterpret_cast(wParam); } -- cgit v1.2.3