MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / Merge

Method Merge

scintilla/lexlib/SparseState.h:78–103  ·  view source on GitHub ↗

Returns true if Merge caused a significant change

Source from the content-addressed store, hash-verified

76
77 // Returns true if Merge caused a significant change
78 bool Merge(const SparseState<T> &other, int ignoreAfter) {
79 // Changes caused beyond ignoreAfter are not significant
80 Delete(ignoreAfter+1);
81
82 bool different = true;
83 bool changed = false;
84 typename stateVector::iterator low = Find(other.positionFirst);
85 if (static_cast<size_t>(states.end() - low) == other.states.size()) {
86 // Same number in other as after positionFirst in this
87 different = !std::equal(low, states.end(), other.states.begin());
88 }
89 if (different) {
90 if (low != states.end()) {
91 states.erase(low, states.end());
92 changed = true;
93 }
94 typename stateVector::const_iterator startOther = other.states.begin();
95 if (!states.empty() && !other.states.empty() && states.back().value == startOther->value)
96 ++startOther;
97 if (startOther != other.states.end()) {
98 states.insert(states.end(), startOther, other.states.end());
99 changed = true;
100 }
101 }
102 return changed;
103 }
104};
105
106#ifdef SCI_NAMESPACE

Callers 1

LexMethod · 0.80

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected