aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2020-08-27 23:39:28 +1000
committerZufu Liu <unknown>2020-08-27 23:39:28 +1000
commit7b14d8aeeff40cbd4aec75b4d14780b39629ed75 (patch)
tree0ebae0095ef9e6088270bebed89cea4cd43a6a5e
parent424dbda14217388ab16878196ef049edf916225d (diff)
downloadscintilla-mirror-7b14d8aeeff40cbd4aec75b4d14780b39629ed75.tar.gz
Backport:Bug [#2197]. Avoid rewrap when checkTextAndStyle finds unchanged from cache.
Backport of changeset 8510:41fb5d858e8c.
-rw-r--r--src/EditView.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index d18a9b4eb..cae02ef5c 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -387,6 +387,9 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
if (posLineEnd >(posLineStart + ll->maxLineLength)) {
posLineEnd = posLineStart + ll->maxLineLength;
}
+ // Hard to cope when too narrow, so just assume there is space
+ width = std::max(width, 20);
+
if (ll->validity == LineLayout::ValidLevel::checkTextAndStyle) {
Sci::Position lineLength = posLineEnd - posLineStart;
if (!vstyle.viewEOL) {
@@ -410,7 +413,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
const int styleByteLast = (posLineEnd > posLineStart) ? model.pdoc->StyleIndexAt(posLineEnd - 1) : 0;
allSame = allSame && (ll->styles[lineLength] == styleByteLast); // For eolFilled
if (allSame) {
- ll->validity = LineLayout::ValidLevel::positions;
+ ll->validity = (ll->widthLine != width) ? LineLayout::ValidLevel::positions : LineLayout::ValidLevel::lines;
} else {
ll->validity = LineLayout::ValidLevel::invalid;
}
@@ -504,10 +507,6 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
ll->numCharsBeforeEOL = numCharsBeforeEOL;
ll->validity = LineLayout::ValidLevel::positions;
}
- // Hard to cope when too narrow, so just assume there is space
- if (width < 20) {
- width = 20;
- }
if ((ll->validity == LineLayout::ValidLevel::positions) || (ll->widthLine != width)) {
ll->widthLine = width;
if (width == LineLayout::wrapWidthInfinite) {