diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ContractionState.cxx | 8 | ||||
-rw-r--r-- | src/ContractionState.h | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 2 | ||||
-rw-r--r-- | src/RunStyles.cxx | 11 | ||||
-rw-r--r-- | src/RunStyles.h | 2 |
5 files changed, 23 insertions, 1 deletions
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 8a1b486e7..4478f3844 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -168,6 +168,14 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible } } +bool ContractionState::HiddenLines() const { + if (OneToOne()) { + return false; + } else { + return !visible->AllSameAs(1); + } +} + bool ContractionState::GetExpanded(int lineDoc) const { if (OneToOne()) { return true; diff --git a/src/ContractionState.h b/src/ContractionState.h index 8e7b39b9b..0309fc269 100644 --- a/src/ContractionState.h +++ b/src/ContractionState.h @@ -48,6 +48,7 @@ public: bool GetVisible(int lineDoc) const; bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); + bool HiddenLines() const; bool GetExpanded(int lineDoc) const; bool SetExpanded(int lineDoc, bool expanded); diff --git a/src/Editor.cxx b/src/Editor.cxx index dee1d8863..e7f768e98 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4538,7 +4538,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); } - if (cs.LinesDisplayed() < cs.LinesInDoc()) { + if (cs.HiddenLines()) { // Some lines are hidden so may need shown. // TODO: check if the modified area is hidden. if (mh.modificationType & SC_MOD_BEFOREINSERT) { diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index 460d5d244..0f2196972 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -216,3 +216,14 @@ void RunStyles::DeleteRange(int position, int deleteLength) { } } +bool RunStyles::AllSame() const { + for (int run = 1; run < starts->Partitions(); run++) { + if (styles->ValueAt(run) != styles->ValueAt(run - 1)) + return false; + } + return true; +} + +bool RunStyles::AllSameAs(int value) const { + return AllSame() && (styles->ValueAt(0) == value); +} diff --git a/src/RunStyles.h b/src/RunStyles.h index 0a333ca2a..a3b7ac7d1 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -37,6 +37,8 @@ public: void InsertSpace(int position, int insertLength); void DeleteAll(); void DeleteRange(int position, int deleteLength); + bool AllSame() const; + bool AllSameAs(int value) const; }; #ifdef SCI_NAMESPACE |