Index: text/fmt/xp/fb_LineBreaker.cpp =================================================================== --- text/fmt/xp/fb_LineBreaker.cpp (revision 32687) +++ text/fmt/xp/fb_LineBreaker.cpp (working copy) @@ -37,7 +37,8 @@ m_pFirstRunToKeep(NULL), m_pLastRunToKeep(NULL), m_iMaxLineWidth(0), - m_iWorkingLineWidth(0) + m_iWorkingLineWidth(0), + m_iTrailingSpace(-1) { xxx_UT_DEBUGMSG(("fb_LineBreaker %x created \n",this)); } @@ -630,7 +631,7 @@ UT_ASSERT(pNewLine); // TODO check for outofmem pNextLine = pNewLine; m_iMaxLineWidth = pNextLine->getMaxWidth(); - xxx_UT_DEBUGMSG(("!!!! Generated a new Line \n")); + xxx_UT_DEBUGMSG(("!!!! Generated a new Line \n")); } else { @@ -648,7 +649,43 @@ while (pRunToBump && pLine->getNumRunsInLine() && (pLine->getLastRun() != m_pLastRunToKeep)) { UT_ASSERT(pRunToBump->getLine() == pLine); - xxx_UT_DEBUGMSG(("RunToBump %x Type %d Offset %d Length %d \n",pRunToBump,pRunToBump->getType(),pRunToBump->getBlockOffset(),pRunToBump->getLength())); + if(pRunToBump->getType() == FPRUN_ENDOFPARAGRAPH ) + { + xxx_UT_DEBUGMSG(("Trailing space present in prev run %d\n",pRunToBump->getPrevRun()->findTrailingSpaceDistance())); +/* +FIX for bug 8795 +================ +if EOP then + if prev run has trailing white space then + 1)store actual trailing space + 2)delay run bump till trailing space is exhausted + else + bump contents into newline +*/ + + if(pRunToBump->getPrevRun()->findTrailingSpaceDistance()) + { + if(m_iTrailingSpace == -1) + { + xxx_UT_DEBUGMSG(("backing up trailing space")); + m_iTrailingSpace = pRunToBump->getPrevRun()->findTrailingSpaceDistance(); + } + if(pLine->getFilledWidth() - m_iTrailingSpace < m_iMaxLineWidth) + { + xxx_UT_DEBUGMSG(("Filledwidth %d TrailingSpace %d FW-TS %d MaxWidth %d",pLine->getFilledWidth(),m_iTrailingSpace,pLine->getFilledWidth() - m_iTrailingSpace, m_iMaxLineWidth)); + break; + } + else + { + xxx_UT_DEBUGMSG(("trailing space over.. should now start newline")); + m_iTrailingSpace = -1; + } + } + + + } + + UT_DEBUGMSG(("RunToBump %x Type %d Offset %d Length %d \n",pRunToBump,pRunToBump->getType(),pRunToBump->getBlockOffset(),pRunToBump->getLength())); if(!pLine->removeRun(pRunToBump)) { // @@ -673,8 +710,12 @@ xxx_UT_DEBUGMSG(("Next runToBump %x \n",pRunToBump)); } } - - UT_ASSERT((!m_pLastRunToKeep) || (pLine->getLastRun() == m_pLastRunToKeep)); +/* +below assert not applicable now since when trailing space +is present the current line is not broken immediately and +delayed till trailing space is exhausted by non blank characters +*/ + //UT_ASSERT((!m_pLastRunToKeep) || (pLine->getLastRun() == m_pLastRunToKeep)); #if DEBUG pLine->assertLineListIntegrity(); if(pNextLine) Index: text/fmt/xp/fb_LineBreaker.h =================================================================== --- text/fmt/xp/fb_LineBreaker.h (revision 32687) +++ text/fmt/xp/fb_LineBreaker.h (working copy) @@ -54,6 +54,7 @@ UT_sint32 m_iMaxLineWidth; UT_sint32 m_iWorkingLineWidth; + UT_sint32 m_iTrailingSpace; }; #endif /* FB_LINEBREAKER_H */