diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-17 08:04:38 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-17 08:04:38 +1000 |
commit | 5e860e519af71bd6e35715b0f4b14910a05463e3 (patch) | |
tree | 95c8f485eaa25aa8c36a65135e85ed1d3bf4bc22 | |
parent | 23dbbd416d77783c0058788c72914c8178696dba (diff) | |
download | scintilla-mirror-5e860e519af71bd6e35715b0f4b14910a05463e3.tar.gz |
Backport: Templatize LineVector so it can later be switched between 32-bits and 64-bits.
Backport of changeset 6694:6df3a85efb80.
-rw-r--r-- | src/CellBuffer.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index d15745fd2..b1836b924 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -45,8 +45,9 @@ public: using namespace Scintilla; +template <typename POS> class LineVector : public ILineVector { - Partitioning<int> starts; + Partitioning<POS> starts; PerLine *perLine; public: LineVector() : starts(256), perLine(0) { @@ -65,10 +66,10 @@ public: perLine = pl; } void InsertText(Sci::Line line, Sci::Position delta) override { - starts.InsertText(line, delta); + starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta)); } void InsertLine(Sci::Line line, Sci::Position position, bool lineStart) override { - starts.InsertPartition(line, position); + starts.InsertPartition(static_cast<POS>(line), static_cast<POS>(position)); if (perLine) { if ((line > 0) && lineStart) line--; @@ -76,10 +77,10 @@ public: } } void SetLineStart(Sci::Line line, Sci::Position position) override { - starts.SetPartitionStartPosition(line, position); + starts.SetPartitionStartPosition(static_cast<POS>(line), static_cast<POS>(position)); } void RemoveLine(Sci::Line line) override { - starts.RemovePartition(line); + starts.RemovePartition(static_cast<POS>(line)); if (perLine) { perLine->RemoveLine(line); } @@ -88,10 +89,10 @@ public: return starts.Partitions(); } Sci::Line LineFromPosition(Sci::Position pos) const override { - return starts.PartitionFromPosition(pos); + return starts.PartitionFromPosition(static_cast<POS>(pos)); } Sci::Position LineStart(Sci::Line line) const override { - return starts.PositionFromPartition(line); + return starts.PositionFromPartition(static_cast<POS>(line)); } }; @@ -368,7 +369,7 @@ CellBuffer::CellBuffer(bool hasStyles_) : readOnly = false; utf8LineEnds = 0; collectingUndo = true; - plv = std::unique_ptr<LineVector>(new LineVector()); + plv = std::unique_ptr<LineVector<Sci::Position>>(new LineVector<Sci::Position>()); } CellBuffer::~CellBuffer() { |