diff options
author | Zufu Liu <unknown> | 2021-06-04 20:27:18 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2021-06-04 20:27:18 +1000 |
commit | 879f0c4c60bd3ba9c75a0f83495eebc7aee66860 (patch) | |
tree | 7aa7a1d1485a0ccd131c428d28400a1f4b2dabe0 /src/Document.cxx | |
parent | b88a820dee352c68e1bf9616d54c1804bf8a15a0 (diff) | |
download | scintilla-mirror-879f0c4c60bd3ba9c75a0f83495eebc7aee66860.tar.gz |
Bug [#2260]. Fix bug with SCI_GETLASTCHILD when lParam is -1.
Fixed cast on SCI_FOLDCHILDREN to use correct type.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 74701bd8c..6531ad264 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -525,14 +525,13 @@ static bool IsSubordinate(FoldLevel levelStart, FoldLevel levelTry) noexcept { } Sci::Line Document::GetLastChild(Sci::Line lineParent, std::optional<FoldLevel> level, Sci::Line lastLine) { - if (!level) - level = LevelNumberPart(GetFoldLevel(lineParent)); + const FoldLevel levelStart = level.value_or(LevelNumberPart(GetFoldLevel(lineParent))); const Sci::Line maxLine = LinesTotal(); const Sci::Line lookLastLine = (lastLine != -1) ? std::min(LinesTotal() - 1, lastLine) : -1; Sci::Line lineMaxSubord = lineParent; while (lineMaxSubord < maxLine - 1) { EnsureStyledTo(LineStart(lineMaxSubord + 2)); - if (!IsSubordinate(*level, GetFoldLevel(lineMaxSubord + 1))) + if (!IsSubordinate(levelStart, GetFoldLevel(lineMaxSubord + 1))) break; if ((lookLastLine != -1) && (lineMaxSubord >= lookLastLine) && !LevelIsWhitespace(GetFoldLevel(lineMaxSubord))) break; |