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/SparseVector.h | |
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/SparseVector.h')
-rw-r--r-- | src/SparseVector.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/SparseVector.h b/src/SparseVector.h index f8c35fdc5..09eb1f98d 100644 --- a/src/SparseVector.h +++ b/src/SparseVector.h @@ -57,6 +57,22 @@ public: return empty; } } + T Extract(Sci::Position position) { + // Move value currently at position; clear and remove position; return value. + // Doesn't remove position at start or end. + assert(position <= Length()); + const Sci::Position partition = ElementFromPosition(position); + assert(partition >= 0); + assert(partition <= starts.Partitions()); + assert(starts.PositionFromPartition(partition) == position); + T value = std::move(values.operator[](partition)); + if ((partition > 0) && (partition < starts.Partitions())) { + starts.RemovePartition(partition); + values.Delete(partition); + } + Check(); + return value; + } template <typename ParamType> void SetValueAt(Sci::Position position, ParamType &&value) { assert(position <= Length()); |