Fix for bug 54016 - crash when indentation wider then wrap width. The fix was to check for that condition. r=akkana@netscape.com, a=vidur@netscape.com

This commit is contained in:
bratell%lysator.liu.se 2000-09-28 05:32:52 +00:00
Родитель ba4d6a252b
Коммит 45171d7daf
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -1233,7 +1233,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
} }
// fallback if the line breaker is unavailable or failed // fallback if the line breaker is unavailable or failed
if (nsnull == mLineBreaker || NS_FAILED(result)) { if (nsnull == mLineBreaker || NS_FAILED(result)) {
goodSpace = mWrapColumn-prefixwidth; goodSpace=(prefixwidth>mWrapColumn)?1:mWrapColumn-prefixwidth;
while (goodSpace >= 0 && while (goodSpace >= 0 &&
!nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) { !nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) {
goodSpace--; goodSpace--;
@ -1244,7 +1244,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
if(goodSpace<0) { if(goodSpace<0) {
// If we don't found a good place to break, accept long line and // If we don't found a good place to break, accept long line and
// try to find another place to break // try to find another place to break
goodSpace=mWrapColumn-prefixwidth+1; goodSpace=(prefixwidth>mWrapColumn+1)?1:mWrapColumn-prefixwidth+1;
result = NS_OK; result = NS_OK;
if (nsnull != mLineBreaker) { if (nsnull != mLineBreaker) {
result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace, result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace,

Просмотреть файл

@ -1233,7 +1233,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
} }
// fallback if the line breaker is unavailable or failed // fallback if the line breaker is unavailable or failed
if (nsnull == mLineBreaker || NS_FAILED(result)) { if (nsnull == mLineBreaker || NS_FAILED(result)) {
goodSpace = mWrapColumn-prefixwidth; goodSpace=(prefixwidth>mWrapColumn)?1:mWrapColumn-prefixwidth;
while (goodSpace >= 0 && while (goodSpace >= 0 &&
!nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) { !nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) {
goodSpace--; goodSpace--;
@ -1244,7 +1244,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
if(goodSpace<0) { if(goodSpace<0) {
// If we don't found a good place to break, accept long line and // If we don't found a good place to break, accept long line and
// try to find another place to break // try to find another place to break
goodSpace=mWrapColumn-prefixwidth+1; goodSpace=(prefixwidth>mWrapColumn+1)?1:mWrapColumn-prefixwidth+1;
result = NS_OK; result = NS_OK;
if (nsnull != mLineBreaker) { if (nsnull != mLineBreaker) {
result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace, result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace,