Skip to content

Commit

Permalink
Weekly Scintilla sync up.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Dec 1, 2024
1 parent 7af8233 commit dfce806
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions scintilla/src/AutoComplete.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cstdio>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/CallTip.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cstdio>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/CellBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cstdio>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/ChangeHistory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cassert>

#include <stdexcept>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/Decoration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cstdio>
Expand Down
20 changes: 9 additions & 11 deletions scintilla/src/Document.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(index - segmentLength);
const uint32_t offset = 63 & static_cast<uint32_t>(position - index);
mask = (mask >> offset) << offset;
}
while (mask) {
Expand Down Expand Up @@ -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<uint32_t>(index - segmentLength);
const uint32_t offset = 31 & static_cast<uint32_t>(position - index);
mask = (mask >> offset) << offset;
}
while (mask) {
Expand Down Expand Up @@ -3185,6 +3185,7 @@ class DocumentIndexer final : public CharacterIndexer {
}
};

class RESearchRange;
/**
* Implementation of RegexSearchBase for the default built-in regular expression engine
*/
Expand All @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -3416,8 +3416,7 @@ bool MatchOnLines(const Document *doc, const Regex &regexp, 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)) {
Expand Down Expand Up @@ -3540,8 +3539,7 @@ bool MatchOnLines(const Document *doc, const Regex &regexp, 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;
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions scintilla/src/Editor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Sci::Line>(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();
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/Indicator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Copyright 1998-2001 by Neil Hodgson <[email protected]>
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstdint>
#include <cmath>

#include <stdexcept>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/KeyMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstdlib>
#include <cstdint>

#include <stdexcept>
#include <string_view>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/LineMarker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Copyright 1998-2011 by Neil Hodgson <[email protected]>
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstdint>
#include <cstring>
#include <cmath>

Expand Down
1 change: 1 addition & 0 deletions scintilla/src/PerLine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstddef>
#include <cstdint>
#include <cassert>
#include <cstring>

Expand Down
2 changes: 2 additions & 0 deletions scintilla/src/Style.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Copyright 1998-2001 by Neil Hodgson <[email protected]>
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstdint>

#include <stdexcept>
#include <string_view>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/ViewStyle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstddef>
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cmath>
Expand Down
1 change: 1 addition & 0 deletions scintilla/src/XPM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// The License.txt file describes the conditions under which this software may be distributed.

#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <climits>

Expand Down
6 changes: 4 additions & 2 deletions scintilla/test/BraceMatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(index - segmentLength);
//const uint32_t offset = 63 & ~static_cast<uint32_t>(index - segmentLength);
const uint32_t offset = 63 & static_cast<uint32_t>(position - index);
mask = (mask >> offset) << offset;
}
while (mask) {
Expand Down Expand Up @@ -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<uint32_t>(index - segmentLength);
//const uint32_t offset = 31 & ~static_cast<uint32_t>(index - segmentLength);
const uint32_t offset = 31 & static_cast<uint32_t>(position - index);
mask = (mask >> offset) << offset;
}
while (mask) {
Expand Down
6 changes: 3 additions & 3 deletions version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dfce806

Please sign in to comment.