Index: fp_Line.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fp_Line.cpp,v
retrieving revision 1.135
diff -u -r1.135 fp_Line.cpp
--- fp_Line.cpp	2001/11/02 20:22:55	1.135
+++ fp_Line.cpp	2001/11/10 21:05:01
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include <math.h>
+#include <locale.h>				// localeconv()
 #include "ut_types.h"	// for FREEP
 
 #include "fl_DocLayout.h"
@@ -1272,14 +1273,15 @@
 						UT_UCSChar *pDecimalStr;
 						UT_uint32	runLen = 0;
 
-						// the string to search for decimals
-						if (UT_UCS_cloneString_char(&pDecimalStr, ".") != true)
+						// find what char represents a decimal point
+						lconv *loc = localeconv();
+						if ( ! UT_UCS_cloneString_char(&pDecimalStr, loc->decimal_point) )
 						{
 							// Out of memory. Now what?
 						}
             	
-		    		    iScanWidth = 0;
-		    	    	iScanWidthLayoutUnits = 0;
+						iScanWidth = 0;
+						iScanWidthLayoutUnits = 0;
 						for ( UT_uint32 j = iIndx+1; j < iCountRuns; j++ )
 						{
 							UT_uint32 iJ;
@@ -1299,7 +1301,9 @@
 								if(decimalBlockOffset != -1)
 								{
 									foundDecimal = true;
-									runLen = pScanRun->getBlockOffset() - decimalBlockOffset;
+									UT_uint32 u_decimalBlockOffset = static_cast<UT_uint32>(decimalBlockOffset);
+									UT_ASSERT(pScanRun->getBlockOffset() <= u_decimalBlockOffset); // runLen is unsigned
+									runLen = u_decimalBlockOffset - pScanRun->getBlockOffset();
 								}
 							}
 
@@ -1307,11 +1311,9 @@
 								__FILE__, __LINE__, foundDecimal, pScanRun->getLength()-runLen, iScanWidth));
 							if ( foundDecimal )
 							{
-								if(pScanRun->getType() == FPRUN_TEXT)
-								{
-									iScanWidth += ((fp_TextRun *)pScanRun)->simpleRecalcWidth(fp_TextRun::Width_type_display, runLen);
-									iScanWidthLayoutUnits += ((fp_TextRun *)pScanRun)->simpleRecalcWidth(fp_TextRun::Width_type_layout_units, runLen);
-								}
+								UT_ASSERT(pScanRun->getType() == FPRUN_TEXT);
+								iScanWidth += ((fp_TextRun *)pScanRun)->simpleRecalcWidth(fp_TextRun::Width_type_display, runLen);
+								iScanWidthLayoutUnits += ((fp_TextRun *)pScanRun)->simpleRecalcWidth(fp_TextRun::Width_type_layout_units, runLen);
 								break; // we found our decimal, don't search any further
 							}
 							else
@@ -1320,10 +1322,17 @@
 								iScanWidthLayoutUnits += pScanRun->getWidthInLayoutUnits();
 							}
 						}
-			            	
-						iXLayoutUnits = iPosLayoutUnits - (UT_sint32)eWorkingDirection * iScanWidthLayoutUnits;
-						iX = iPosLayoutUnits * Screen_resolution / UT_LAYOUT_UNITS - (UT_sint32)eWorkingDirection * iScanWidth;
-						iWidth = abs(iX - iXprev);
+
+						if ( iScanWidthLayoutUnits > abs(iPosLayoutUnits - iXLayoutUnits)) {
+							// out of space before the decimal point;
+							// tab collapses to nothing
+							iWidth = 0;
+						}
+						else {
+							iXLayoutUnits = iPosLayoutUnits - (UT_sint32)eWorkingDirection * iScanWidthLayoutUnits;
+							iX = iPosLayoutUnits * Screen_resolution / UT_LAYOUT_UNITS - (UT_sint32)eWorkingDirection * iScanWidth;
+							iWidth = abs(iX - iXprev);
+						}
 						FREEP(pDecimalStr);	
 						break;
 					}
