diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 5ac755b1e..e163bb433 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -3662,9 +3662,9 @@ void ScintillaEditView::hideLines() int scope = 0; bool recentMarkerWasOpen = false; - auto removeMarker = [this, &scope, &recentMarkerWasOpen](size_t line) + auto removeMarker = [this, &scope, &recentMarkerWasOpen](size_t line, int markerMask) { - auto state = execute(SCI_MARKERGET, line); + auto state = execute(SCI_MARKERGET, line) & markerMask; bool closePresent = (state & (1 << MARK_HIDELINESEND)) != 0; bool openPresent = (state & (1 << MARK_HIDELINESBEGIN)) != 0; @@ -3687,8 +3687,8 @@ void ScintillaEditView::hideLines() size_t endMarker = endLine + 1; // Remove all previous markers in between new ones - for (size_t i = startMarker + 1; i < endMarker; ++i) - removeMarker(i); + for (size_t i = startLine; i <= endLine; ++i) + removeMarker(i, (1 << MARK_HIDELINESBEGIN) | (1 << MARK_HIDELINESEND)); // When hiding lines just below/above other hidden lines, // merge them into one hidden section: @@ -3699,10 +3699,10 @@ void ScintillaEditView::hideLines() // Both "while" loops are executed (merge with above AND below hidden section): while (scope == 0) - removeMarker(--startMarker); + removeMarker(--startMarker, 1 << MARK_HIDELINESBEGIN); while (scope != 0) - removeMarker(++endMarker); + removeMarker(++endMarker, 1 << MARK_HIDELINESEND); } else { @@ -3710,10 +3710,10 @@ void ScintillaEditView::hideLines() // If true, only one "while" loop is executed (merge with adjacent hidden section): while (scope < 0) - removeMarker(--startMarker); + removeMarker(--startMarker, 1 << MARK_HIDELINESBEGIN); while (scope > 0) - removeMarker(++endMarker); + removeMarker(++endMarker, 1 << MARK_HIDELINESEND); } execute(SCI_MARKERADD, startMarker, MARK_HIDELINESBEGIN);