diff options
author | Neil <nyamatongwe@gmail.com> | 2022-07-31 15:51:53 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2022-07-31 15:51:53 +1000 |
commit | 926cb6f7d228b347db16a45e1f2632da475da1f0 (patch) | |
tree | 6263662cb8c023502d61b61eed34baa93ed35843 /src/Document.cxx | |
parent | 535e20189d5a2dd9b43a6ea0a74749a50678d631 (diff) | |
download | scintilla-mirror-926cb6f7d228b347db16a45e1f2632da475da1f0.tar.gz |
Added change history which can display document changes (modified, saved, ...)
in the margin or in the text.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 2312e3f5a..1c3015c92 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -339,8 +339,32 @@ void Document::TentativeUndo() { } } -int Document::GetMark(Sci::Line line) const noexcept { - return Markers()->MarkValue(line); +int Document::GetMark(Sci::Line line, bool includeChangeHistory) const { + int marksHistory = 0; + if (includeChangeHistory) { + int marksEdition = 0; + + const Sci::Position start = LineStart(line); + const Sci::Position lineNext = LineStart(line + 1); + for (Sci::Position position = start; position < lineNext;) { + const int edition = EditionAt(position); + if (edition) { + marksEdition |= 1 << (edition-1); + } + position = EditionEndRun(position); + } + const Sci::Position lineEnd = LineEnd(line); + for (Sci::Position position = start; position <= lineEnd;) { + marksEdition |= EditionDeletesAt(position); + position = EditionNextDelete(position); + } + + /* Bits: RevertedToOrigin, Saved, Modified, RevertedToModified */ + constexpr unsigned int editionShift = static_cast<unsigned int>(MarkerOutline::HistoryRevertedToOrigin); + marksHistory = marksEdition << editionShift; + } + + return marksHistory | Markers()->MarkValue(line); } Sci::Line Document::MarkerNext(Sci::Line lineStart, int mask) const noexcept { |