aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-17 08:04:38 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-17 08:04:38 +1000
commit7f93e6b2bdd4a9eae6426617cde141b85ceaa568 (patch)
treee08d662a980b77c4a267974d63ffc02d61d5c737 /src/CellBuffer.cxx
parent7957f320052b8b724af43f779282fa63cefd4513 (diff)
downloadscintilla-mirror-7f93e6b2bdd4a9eae6426617cde141b85ceaa568.tar.gz
Templatize LineVector so it can later be switched between 32-bits and 64-bits.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r--src/CellBuffer.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 0ee66ce7c..d6d83c20b 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::make_unique<LineVector>();
+ plv = std::make_unique<LineVector<Sci::Position>>();
}
CellBuffer::~CellBuffer() {