aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index ed3a08270..1f3a803fc 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -81,23 +81,17 @@ LineLayout::LineLayout(Sci::Line lineNumber_, int maxLineLength_) :
Resize(maxLineLength_);
}
-LineLayout::~LineLayout() {
- Free();
-}
-
void LineLayout::Resize(int maxLineLength_) {
if (maxLineLength_ > maxLineLength) {
- Free();
const size_t lineAllocation = maxLineLength_ + 1;
chars = std::make_unique<char[]>(lineAllocation);
styles = std::make_unique<unsigned char []>(lineAllocation);
// Extra position allocated as sometimes the Windows
// GetTextExtentExPoint API writes an extra element.
positions = std::make_unique<XYPOSITION []>(lineAllocation + 1);
- if (bidiData) {
- bidiData->Resize(maxLineLength_);
- }
-
+ lineStarts.reset();
+ bidiData.reset();
+ lenLineStarts = 0;
maxLineLength = maxLineLength_;
}
}
@@ -116,15 +110,6 @@ void LineLayout::EnsureBidiData() {
}
}
-void LineLayout::Free() noexcept {
- chars.reset();
- styles.reset();
- positions.reset();
- lineStarts.reset();
- lenLineStarts = 0;
- bidiData.reset();
-}
-
void LineLayout::ClearPositions() {
std::fill(&positions[0], &positions[maxLineLength + 2], 0.0f);
}