Index: kdecore/kstringhandler.cpp =================================================================== RCS file: /home/kde/kdelibs/kdecore/kstringhandler.cpp,v retrieving revision 1.35 diff -u -r1.35 kstringhandler.cpp --- kdecore/kstringhandler.cpp 29 Jan 2004 11:35:14 -0000 1.35 +++ kdecore/kstringhandler.cpp 31 Jan 2004 01:49:31 -0000 @@ -320,7 +320,9 @@ return s; } - const unsigned int maxWidth = width - fm.width( '.' ) * 3; + const unsigned int maxWidth = width > (uint) fm.width( '.') * 3 + ? width - (uint) fm.width( '.' ) * 3 + : width; if ( maxWidth <= 0 ) { return "..."; } @@ -328,11 +330,11 @@ unsigned int leftIdx = 0, rightIdx = length; unsigned int leftWidth = fm.charWidth( s, leftIdx++ ); unsigned int rightWidth = fm.charWidth( s, --rightIdx ); - while ( leftWidth + rightWidth < maxWidth ) { - while ( leftWidth <= rightWidth && leftWidth + rightWidth < maxWidth ) { + while ( leftWidth + rightWidth < maxWidth && leftIdx < length && rightIdx > 0 ) { + while ( leftWidth <= rightWidth && leftWidth + rightWidth < maxWidth && leftIdx < length ) { leftWidth += fm.charWidth( s, leftIdx++ ); } - while ( rightWidth <= leftWidth && leftWidth + rightWidth < maxWidth ) { + while ( rightWidth <= leftWidth && leftWidth + rightWidth < maxWidth && rightIdx > 0 ) { rightWidth += fm.charWidth( s, --rightIdx ); } }