diff options
| author | nyamatongwe <devnull@localhost> | 2004-01-04 06:13:35 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2004-01-04 06:13:35 +0000 | 
| commit | cdf29ee6f6aa008ba3e516891afebbb0e44fa2df (patch) | |
| tree | 289d4bf8f2f4712562c146c6b17228df1351db44 /src/Editor.cxx | |
| parent | f9cd05523ab8512ad55bbb9715d9dd95229077a5 (diff) | |
| download | scintilla-mirror-cdf29ee6f6aa008ba3e516891afebbb0e44fa2df.tar.gz | |
Fixes to avoid laying out lines after end of document when
performing wrapping.
Diffstat (limited to 'src/Editor.cxx')
| -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 | 
