diff --git a/scintilla/src/AutoComplete.cxx b/scintilla/src/AutoComplete.cxx index 388ff7e9bc..c2b99d5f8a 100644 --- a/scintilla/src/AutoComplete.cxx +++ b/scintilla/src/AutoComplete.cxx @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index e0942313cc..e2c48740cc 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 071717e1df..a9fb6c7c5f 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/scintilla/src/ChangeHistory.cxx b/scintilla/src/ChangeHistory.cxx index d86b481052..8fefba9c14 100644 --- a/scintilla/src/ChangeHistory.cxx +++ b/scintilla/src/ChangeHistory.cxx @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/scintilla/src/Decoration.cxx b/scintilla/src/Decoration.cxx index c1b968130d..6cc147a4b9 100644 --- a/scintilla/src/Decoration.cxx +++ b/scintilla/src/Decoration.cxx @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index ffe82eedce..81c4253c79 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -3027,7 +3027,7 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe } while (position >= endPos); if (index >= segmentLength && position < segmentLength) { position = segmentLength - 1; - const uint32_t offset = 63 ^ static_cast(index - segmentLength); + const uint32_t offset = 63 & static_cast(position - index); mask = (mask >> offset) << offset; } while (mask) { @@ -3123,7 +3123,7 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe } while (position >= endPos); if (index >= segmentLength && position < segmentLength) { position = segmentLength - 1; - const uint32_t offset = 31 ^ static_cast(index - segmentLength); + const uint32_t offset = 31 & static_cast(position - index); mask = (mask >> offset) << offset; } while (mask) { @@ -3185,6 +3185,7 @@ class DocumentIndexer final : public CharacterIndexer { } }; +class RESearchRange; /** * Implementation of RegexSearchBase for the default built-in regular expression engine */ @@ -3197,7 +3198,7 @@ class BuiltinRegex final : public RegexSearchBase { const char *SubstituteByPosition(const Document *doc, const char *text, Sci::Position *length) override; #if defined(BOOST_REGEX_STANDALONE) || !defined(NO_CXX11_REGEX) - Sci::Position CxxRegexFindText(const Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *pattern, FindOption flags, Sci::Position *length); + Sci::Position CxxRegexFindText(const Document *doc, const RESearchRange &resr, const char *pattern, FindOption flags, Sci::Position *length); #endif private: @@ -3220,14 +3221,13 @@ class BuiltinRegex final : public RegexSearchBase { */ class RESearchRange { public: - const Document *doc; int increment; Sci::Position startPos; Sci::Position endPos; Sci::Line lineRangeStart; Sci::Line lineRangeEnd; Sci::Line lineRangeBreak; - RESearchRange(const Document *doc_, Sci::Position minPos, Sci::Position maxPos) noexcept : doc(doc_) { + RESearchRange(const Document *doc, Sci::Position minPos, Sci::Position maxPos) noexcept { increment = (minPos <= maxPos) ? 1 : -1; // Range endpoints should not be inside DBCS characters or between a CR and LF, @@ -3416,8 +3416,7 @@ bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange return matched; } -Sci::Position BuiltinRegex::CxxRegexFindText(const Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *pattern, FindOption flags, Sci::Position *length) { - const RESearchRange resr(doc, minPos, maxPos); +Sci::Position BuiltinRegex::CxxRegexFindText(const Document *doc, const RESearchRange &resr, const char *pattern, FindOption flags, Sci::Position *length) { try { boost::wregex::flag_type flagsRe = boost::wregex::ECMAScript; if (!FlagSet(flags, FindOption::MatchCase)) { @@ -3540,8 +3539,7 @@ bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange return matched; } -Sci::Position BuiltinRegex::CxxRegexFindText(const Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *pattern, FindOption flags, Sci::Position *length) { - const RESearchRange resr(doc, minPos, maxPos); +Sci::Position BuiltinRegex::CxxRegexFindText(const Document *doc, const RESearchRange &resr, const char *pattern, FindOption flags, Sci::Position *length) { try { //const ElapsedPeriod ep; std::wregex::flag_type flagsRe = std::wregex::ECMAScript; @@ -3594,13 +3592,13 @@ Sci::Position BuiltinRegex::CxxRegexFindText(const Document *doc, Sci::Position #endif // BOOST_REGEX_STANDALONE || !NO_CXX11_REGEX Sci::Position BuiltinRegex::FindText(const Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *pattern, FindOption flags, Sci::Position *length) { + const RESearchRange resr(doc, minPos, maxPos); #if defined(BOOST_REGEX_STANDALONE) || !defined(NO_CXX11_REGEX) if (FlagSet(flags, FindOption::Cxx11RegEx)) { - return CxxRegexFindText(doc, minPos, maxPos, pattern, flags, length); + return CxxRegexFindText(doc, resr, pattern, flags, length); } #endif - const RESearchRange resr(doc, minPos, maxPos); const size_t patternLen = *length; const char *errmsg = search.Compile(pattern, patternLen, flags); if (errmsg) { diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 1e40919b1e..db01ef8ced 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -2794,6 +2794,12 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { const Sci::Line lineDoc = pdoc->SciLineFromPosition(mh.position); const Sci::Line lines = std::max(0, mh.linesAdded); if (Wrapping()) { + // Check if this modification crosses any of the wrap points + if (wrapPending.NeedsWrap()) { + if (lineDoc < wrapPending.end) { // Inserted/deleted before or inside wrap range + wrapPending.end += mh.linesAdded; + } + } NeedWrapping(lineDoc, lineDoc + lines + 1); } RefreshStyleData(); diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx index 216855b18c..9eaf257e16 100644 --- a/scintilla/src/Indicator.cxx +++ b/scintilla/src/Indicator.cxx @@ -5,6 +5,7 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#include #include #include diff --git a/scintilla/src/KeyMap.cxx b/scintilla/src/KeyMap.cxx index 7e23514a39..520bd505b4 100644 --- a/scintilla/src/KeyMap.cxx +++ b/scintilla/src/KeyMap.cxx @@ -6,6 +6,7 @@ // The License.txt file describes the conditions under which this software may be distributed. #include +#include #include #include diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index b25171459b..e323d5d080 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -5,6 +5,7 @@ // Copyright 1998-2011 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#include #include #include diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx index 87efb4e4ee..f85aa3d8b5 100644 --- a/scintilla/src/PerLine.cxx +++ b/scintilla/src/PerLine.cxx @@ -6,6 +6,7 @@ // The License.txt file describes the conditions under which this software may be distributed. #include +#include #include #include diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx index 4387a0c480..fde5eed355 100644 --- a/scintilla/src/Style.cxx +++ b/scintilla/src/Style.cxx @@ -5,6 +5,8 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#include + #include #include #include diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index 03f7f4fcfb..b10bdbafbc 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -6,6 +6,7 @@ // The License.txt file describes the conditions under which this software may be distributed. #include +#include #include #include #include diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx index 2c0888fa86..07fb3ce366 100644 --- a/scintilla/src/XPM.cxx +++ b/scintilla/src/XPM.cxx @@ -6,6 +6,7 @@ // The License.txt file describes the conditions under which this software may be distributed. #include +#include #include #include diff --git a/scintilla/test/BraceMatchTest.cpp b/scintilla/test/BraceMatchTest.cpp index 478f481164..b52eefc966 100644 --- a/scintilla/test/BraceMatchTest.cpp +++ b/scintilla/test/BraceMatchTest.cpp @@ -139,7 +139,8 @@ void FindAllBraceBackward(const SplitView &cbView, ptrdiff_t position, uint32_t } while (position >= endPos); if (index >= segmentLength && position < segmentLength) { position = segmentLength - 1; - const uint32_t offset = 63 ^ static_cast(index - segmentLength); + //const uint32_t offset = 63 & ~static_cast(index - segmentLength); + const uint32_t offset = 63 & static_cast(position - index); mask = (mask >> offset) << offset; } while (mask) { @@ -180,7 +181,8 @@ void FindAllBraceBackward(const SplitView &cbView, ptrdiff_t position, uint32_t } while (position >= endPos); if (index >= segmentLength && position < segmentLength) { position = segmentLength - 1; - const uint32_t offset = 31 ^ static_cast(index - segmentLength); + //const uint32_t offset = 31 & ~static_cast(index - segmentLength); + const uint32_t offset = 31 & static_cast(position - index); mask = (mask >> offset) << offset; } while (mask) { diff --git a/version.txt b/version.txt index d0d46f90a7..2547a0e64f 100644 --- a/version.txt +++ b/version.txt @@ -5,17 +5,17 @@ git clone https://github.com/XhmikosR/notepad2-mod.git Scintilla (upstream) hg clone http://hg.code.sf.net/p/scintilla/code scintilla 5.5.3 -2024-10-19 9595:71d4ce5533b4 +2024-12-01 9608:9efd284c1e24 Lexilla (upstream) git clone https://github.com/ScintillaOrg/lexilla.git 5.4.1 -2024-10-19 1498fb254376a1be3bc4e3433f45cbd97c86b214 +2024-11-30 cf1070c1cc921a7ca77d806b47c39ed0b57cdd94 SciTE (upstream) hg clone http://hg.code.sf.net/p/scintilla/scite 5.5.3 -2024-10-19 6354:c1fb7359e0cf +2024-11-26 6361:42e286d36ce6 Boost regex 7.0.1 1.86 https://github.com/boostorg/regex