diff options
author | Neil <nyamatongwe@gmail.com> | 2023-03-02 22:02:19 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-03-02 22:02:19 +1100 |
commit | 43ba96d61994db084e61b31df278d2d87c1f313c (patch) | |
tree | 9ec2084b3a8594434889fb622f2fe7c5446dc0a9 /src/PositionCache.cxx | |
parent | c61df8742a4865ac9c67f8ed017248b82fe5574e (diff) | |
download | scintilla-mirror-43ba96d61994db084e61b31df278d2d87c1f313c.tar.gz |
Add multithreaded wrap to significantly improve performance of wrapping large
files.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 30d76b1d3..9f4e4edc7 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -102,6 +102,13 @@ void LineLayout::Resize(int maxLineLength_) { } } +void LineLayout::ReSet(Sci::Line lineNumber_, Sci::Position maxLineLength_) { + lineNumber = lineNumber_; + Resize(static_cast<int>(maxLineLength_)); + lines = 0; + Invalidate(ValidLevel::invalid); +} + void LineLayout::EnsureBidiData() { if (!bidiData) { bidiData = std::make_unique<BidiData>(); @@ -114,6 +121,7 @@ void LineLayout::Free() noexcept { styles.reset(); positions.reset(); lineStarts.reset(); + lenLineStarts = 0; bidiData.reset(); } @@ -446,6 +454,21 @@ XYPOSITION ScreenLine::TabPositionAfter(XYPOSITION xPosition) const { return (std::floor((xPosition + TabWidthMinimumPixels()) / TabWidth()) + 1) * TabWidth(); } +bool SignificantLines::LineMayCache(Sci::Line line) const noexcept { + switch (level) { + case LineCache::None: + return false; + case LineCache::Caret: + return line == lineCaret; + case LineCache::Page: + return (abs(line - lineCaret) < linesOnScreen) || + ((line >= lineTop) && (line <= (lineTop + linesOnScreen))); + case LineCache::Document: + default: + return true; + } +} + LineLayoutCache::LineLayoutCache() : level(LineCache::None), allInvalidated(false), styleClock(-1) { |