From 93ae9c7f3dc276628d162c53267b65b89685ead2 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 27 Mar 2004 03:47:40 +0000 Subject: Fixed bug when wrapping and undo removes all text in document. --- src/Editor.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 64aa75987..f1f1adb82 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1394,6 +1394,8 @@ void Editor::InvalidateCaret() { } void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) { + docLineStartWrapping = Platform::Minimum(docLineStartWrapping, pdoc->LinesTotal()-1); + docLineEndWrapping = Platform::Minimum(docLineEndWrapping, pdoc->LinesTotal()-1); bool noWrap = (docLastLineToWrap == docLineLastWrapped); if (docLineLastWrapped > (docLineStartWrapping - 1)) { docLineLastWrapped = docLineStartWrapping - 1; @@ -1411,7 +1413,9 @@ void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) { if (docLastLineToWrap >= pdoc->LinesTotal()) docLastLineToWrap = pdoc->LinesTotal()-1; // Wrap lines during idle. - if (backgroundWrapEnabled && docLastLineToWrap != docLineLastWrapped ) { + if ((wrapState != eWrapNone) && + backgroundWrapEnabled && + (docLastLineToWrap != docLineLastWrapped)) { SetIdle(true); } } @@ -1492,6 +1496,7 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { firstLineToWrap++; if (!priorityWrap) docLineLastWrapped++; + if (firstLineToWrap < pdoc->LinesTotal()) { AutoLineLayout ll(llc, RetrieveLineLayout(firstLineToWrap)); int linesWrapped = 1; if (ll) { @@ -1500,6 +1505,7 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { } if (cs.SetHeight(firstLineToWrap, linesWrapped)) { wrapOccurred = true; + } } } // If wrapping is done, bring it to resting position -- cgit v1.2.3