diff options
author | nyamatongwe <unknown> | 2004-01-04 06:13:35 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-01-04 06:13:35 +0000 |
commit | 4e902f4ae6725f4c460c5e8f8cd1ac5c45b748b1 (patch) | |
tree | 289d4bf8f2f4712562c146c6b17228df1351db44 /src | |
parent | 6f175c01c94101895ff01c66e48dd74283a368c7 (diff) | |
download | scintilla-mirror-4e902f4ae6725f4c460c5e8f8cd1ac5c45b748b1.tar.gz |
Fixes to avoid laying out lines after end of document when
performing wrapping.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index bc74e51bd..f0f10e25a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1399,17 +1399,13 @@ void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) { } if (noWrap) { docLastLineToWrap = docLineEndWrapping; - if (docLastLineToWrap < -1) - docLastLineToWrap = -1; - if (docLastLineToWrap > pdoc->LinesTotal()) - docLastLineToWrap = pdoc->LinesTotal(); } else if (docLastLineToWrap < docLineEndWrapping) { docLastLineToWrap = docLineEndWrapping + 1; - if (docLastLineToWrap < -1) - docLastLineToWrap = -1; - if (docLastLineToWrap > pdoc->LinesTotal()) - docLastLineToWrap = pdoc->LinesTotal(); } + if (docLastLineToWrap < -1) + docLastLineToWrap = -1; + if (docLastLineToWrap >= pdoc->LinesTotal()) + docLastLineToWrap = pdoc->LinesTotal()-1; // Wrap lines during idle. if (backgroundWrapEnabled && docLastLineToWrap != docLineLastWrapped ) { SetIdle(true); @@ -1481,14 +1477,14 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { } else { // This is idle wrap. lastLineToWrap = docLineLastWrapped + 100; - if (lastLineToWrap >= docLastLineToWrap) - lastLineToWrap = docLastLineToWrap; } + if (lastLineToWrap >= docLastLineToWrap) + lastLineToWrap = docLastLineToWrap; } // else do a fullWrap. // printf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, firstLineToWrap, lastLineToWrap); // printf("Pending wraps: %d to %d\n", docLineLastWrapped, docLastLineToWrap); - while (firstLineToWrap <= lastLineToWrap) { + while (firstLineToWrap < lastLineToWrap) { firstLineToWrap++; if (!priorityWrap) docLineLastWrapped++; @@ -1826,6 +1822,7 @@ LineLayout *Editor::RetrieveLineLayout(int lineNumber) { void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) { if (!ll) return; + PLATFORM_ASSERT(line < pdoc->LinesTotal()); int posLineStart = pdoc->LineStart(line); int posLineEnd = pdoc->LineStart(line + 1); // If the line is very long, limit the treatment to a length that should fit in the viewport |