aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-07-23 13:08:52 +0000
committernyamatongwe <unknown>2002-07-23 13:08:52 +0000
commit6499d56dd0f0e264c00fb6720c2a6966e5986206 (patch)
treea94211090a2cbb4933d997d54fae25925487d38c /src
parent203dcf1e266f9561c15e1f926b7f56c0cfb76e0b (diff)
downloadscintilla-mirror-6499d56dd0f0e264c00fb6720c2a6966e5986206.tar.gz
Removed unnecessary line layout cache invalidation.
Fixed problem where wrap needed was moving the last wrapped line forward past lines that were not yet wrapped. Minor improvement to LineLayout to handle lines that only need a single display line which is the majority most of the time.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index b5143090b..c243e00a6 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -181,14 +181,11 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
}
if (lengthForLevel > size) {
Deallocate();
- } else {
- if (lengthForLevel < length) {
- for (int i=lengthForLevel; i<length; i++) {
- delete cache[i];
- cache[i] = 0;
- }
+ } else if (lengthForLevel < length) {
+ for (int i=lengthForLevel; i<length; i++) {
+ delete cache[i];
+ cache[i] = 0;
}
- Invalidate(LineLayout::llInvalid);
}
if (!cache) {
Allocate(lengthForLevel);
@@ -1219,10 +1216,12 @@ void Editor::InvalidateCaret() {
}
void Editor::NeedWrapping(int docLineStartWrapping) {
- docLineLastWrapped = docLineStartWrapping - 1;
- if (docLineLastWrapped < -1)
- docLineLastWrapped = -1;
- llc.Invalidate(LineLayout::llPositions);
+ if (docLineLastWrapped > (docLineStartWrapping - 1)) {
+ docLineLastWrapped = docLineStartWrapping - 1;
+ if (docLineLastWrapped < -1)
+ docLineLastWrapped = -1;
+ llc.Invalidate(LineLayout::llPositions);
+ }
}
// Check if wrapping needed and perform any needed wrapping.
@@ -1623,6 +1622,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
ll->widthLine = width;
if (width == LineLayout::wrapWidthInfinite) {
ll->lines = 1;
+ } else if (width > ll->positions[ll->numCharsInLine]) {
+ // Simple common case where line does not need wrapping.
+ ll->lines = 1;
} else {
ll->lines = 0;
// Calculate line start positions based upon width.