From 6499d56dd0f0e264c00fb6720c2a6966e5986206 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 23 Jul 2002 13:08:52 +0000 Subject: 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. --- src/Editor.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src') 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 (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. -- cgit v1.2.3