aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2002-07-23 13:08:52 +0000
committernyamatongwe <devnull@localhost>2002-07-23 13:08:52 +0000
commitdfa5edab84afbb75cd4a90b1c810f111b50e9536 (patch)
treea94211090a2cbb4933d997d54fae25925487d38c /src
parente47f2d9a0d8cf8c6c965016bb13a0eaa983e7196 (diff)
downloadscintilla-mirror-dfa5edab84afbb75cd4a90b1c810f111b50e9536.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.