diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 2 | ||||
-rw-r--r-- | src/PerLine.cxx | 17 | ||||
-rw-r--r-- | src/PerLine.h | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 8e80502e0..5fd2f79e5 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2424,7 +2424,7 @@ void Document::SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noex } int SCI_METHOD Document::SetLineState(Sci_Position line, int state) { - const int statePrevious = States()->SetLineState(line, state); + const int statePrevious = States()->SetLineState(line, state, LinesTotal()); if (state != statePrevious) { const DocModification mh(ModificationFlags::ChangeLineState, LineStart(line), 0, 0, nullptr, static_cast<Sci::Line>(line)); diff --git a/src/PerLine.cxx b/src/PerLine.cxx index 2ea3f0ce4..f3fddcf27 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -262,15 +262,13 @@ void LineLevels::ClearLevels() { } int LineLevels::SetLevel(Sci::Line line, int level, Sci::Line lines) { - int prev = 0; + int prev = level; if ((line >= 0) && (line < lines)) { if (!levels.Length()) { ExpandLevels(lines + 1); } prev = levels[line]; - if (prev != level) { - levels[line] = level; - } + levels[line] = level; } return prev; } @@ -312,10 +310,13 @@ void LineState::RemoveLine(Sci::Line line) { } } -int LineState::SetLineState(Sci::Line line, int state) { - lineStates.EnsureLength(line + 1); - const int stateOld = lineStates[line]; - lineStates[line] = state; +int LineState::SetLineState(Sci::Line line, int state, Sci::Line lines) { + int stateOld = state; + if ((line >= 0) && (line < lines)) { + lineStates.EnsureLength(lines + 1); + stateOld = lineStates[line]; + lineStates[line] = state; + } return stateOld; } diff --git a/src/PerLine.h b/src/PerLine.h index 3f7defa3c..ef9e36932 100644 --- a/src/PerLine.h +++ b/src/PerLine.h @@ -111,7 +111,7 @@ public: void InsertLines(Sci::Line line, Sci::Line lines) override; void RemoveLine(Sci::Line line) override; - int SetLineState(Sci::Line line, int state); + int SetLineState(Sci::Line line, int state, Sci::Line lines); int GetLineState(Sci::Line line); Sci::Line GetMaxLineState() const noexcept; }; |