diff -Naur --exclude=CVS abi/src/text/fmt/xp/fl_BlockLayout.cpp abi-cursorfix/src/text/fmt/xp/fl_BlockLayout.cpp --- abi/src/text/fmt/xp/fl_BlockLayout.cpp Sun Jan 30 15:45:31 2000 +++ abi-cursorfix/src/text/fmt/xp/fl_BlockLayout.cpp Mon Apr 3 04:51:58 2000 @@ -878,7 +878,7 @@ UT_ASSERT(iPos >= dPos); UT_uint32 iRelOffset = iPos - dPos; - + if(iRelOffset < 0) iRelOffset = 0; if (!m_pFirstLine || !m_pFirstRun) { // when we have no formatting information, can't find anything @@ -889,10 +889,21 @@ while (pRun) { UT_uint32 iWhere = pRun->containsOffset(iRelOffset); + if (FP_RUN_JUSTAFTER == iWhere) + { + if(pRun->getNext()) + { + if(pRun->getNext()->containsOffset(iRelOffset) == FP_RUN_INSIDE) + { + pRun->findPointCoords(iRelOffset, x, y, height); + return pRun->getNext(); + } + } + } if (FP_RUN_INSIDE == iWhere) { - pRun->findPointCoords(iRelOffset, x, y, height); - return pRun; + pRun->findPointCoords(iRelOffset, x, y, height); + return pRun; } else if (bEOL && (FP_RUN_JUSTAFTER == iWhere)) { @@ -918,8 +929,17 @@ UT_uint32 iWhere = pRun->containsOffset(iRelOffset); if ((FP_RUN_JUSTAFTER == iWhere)) { - pRun->findPointCoords(iRelOffset, x, y, height); - return pRun; + fp_Run* nextRun = pRun->getNext(); + if(nextRun) + { + nextRun->lookupProperties(); + nextRun->findPointCoords(iRelOffset, x, y, height); + } + else + { + pRun->findPointCoords(iRelOffset, x, y, height); + } + return pRun; } if (!pRun->getNext()) @@ -931,7 +951,6 @@ return pRun; } } - pRun = pRun->getNext(); } @@ -946,10 +965,16 @@ { if (pRun->canContainPoint()) { - pRun->findPointCoords(iRelOffset, x, y, height); + if(!pRun->getNext()) + { + pRun->findPointCoords(iRelOffset, x, y, height); + } + else + { + pRun->getNext()->findPointCoords(iRelOffset, x, y, height); + } return pRun; } - pRun = pRun->getNext(); } @@ -2021,7 +2046,6 @@ // pOtherHalfOfSplitRun->recalcWidth(); } - pRun = pRun->getNext(); } diff -Naur --exclude=CVS abi/src/text/fmt/xp/fp_FmtMarkRun.cpp abi-cursorfix/src/text/fmt/xp/fp_FmtMarkRun.cpp --- abi/src/text/fmt/xp/fp_FmtMarkRun.cpp Fri Jan 7 20:51:40 2000 +++ abi-cursorfix/src/text/fmt/xp/fp_FmtMarkRun.cpp Mon Apr 3 03:11:48 2000 @@ -74,6 +74,20 @@ m_iDescentLayoutUnits = m_pG->getFontDescent(); m_iHeightLayoutUnits = m_pG->getFontHeight(); + PD_Document * pDoc = m_pBL->getDocument(); + + const XML_Char * pszPosition = PP_evalProperty("text-position",pSpanAP,pBlockAP,pSectionAP, pDoc, UT_TRUE); + + if (0 == UT_stricmp(pszPosition, "superscript")) + { + m_fPosition = TEXT_POSITION_SUPERSCRIPT; + } + else if (0 == UT_stricmp(pszPosition, "subscript")) + { + m_fPosition = TEXT_POSITION_SUBSCRIPT; + } + else m_fPosition = TEXT_POSITION_NORMAL; + } UT_Bool fp_FmtMarkRun::canBreakAfter(void) const @@ -106,9 +120,18 @@ UT_ASSERT(m_pLine); m_pLine->getOffsets(this, xoff, yoff); + if (m_fPosition == TEXT_POSITION_SUPERSCRIPT) + { + yoff -= m_iAscent * 1/2; + } + else if (m_fPosition == TEXT_POSITION_SUBSCRIPT) + { + yoff += m_iDescent /* * 3/2 */; + } x = xoff; y = yoff; height = m_iHeight; + } UT_uint32 fp_FmtMarkRun::containsOffset(UT_uint32 /* iOffset */) diff -Naur --exclude=CVS abi/src/text/fmt/xp/fp_Run.cpp abi-cursorfix/src/text/fmt/xp/fp_Run.cpp --- abi/src/text/fmt/xp/fp_Run.cpp Thu Mar 30 02:21:59 2000 +++ abi-cursorfix/src/text/fmt/xp/fp_Run.cpp Mon Apr 3 03:11:48 2000 @@ -237,13 +237,13 @@ UT_uint32 fp_Run::containsOffset(UT_uint32 iOffset) { - if ((iOffset >= m_iOffsetFirst) && (iOffset < (m_iOffsetFirst + m_iLen))) + if (iOffset == (m_iOffsetFirst + m_iLen)) { - return FP_RUN_INSIDE; + return FP_RUN_JUSTAFTER; } - else if (iOffset == (m_iOffsetFirst + m_iLen)) + else if ((iOffset >= m_iOffsetFirst) && (iOffset < (m_iOffsetFirst + m_iLen))) { - return FP_RUN_JUSTAFTER; + return FP_RUN_INSIDE; } else { @@ -406,6 +406,8 @@ } } + + ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// @@ -1023,6 +1025,7 @@ x = xoff; y = yoff; height = m_pLine->getHeight(); + } void fp_ForcedColumnBreakRun::_clearScreen(UT_Bool /* bFullLineHeightRect */) diff -Naur --exclude=CVS abi/src/text/fmt/xp/fp_Run.h abi-cursorfix/src/text/fmt/xp/fp_Run.h --- abi/src/text/fmt/xp/fp_Run.h Thu Mar 30 02:21:59 2000 +++ abi-cursorfix/src/text/fmt/xp/fp_Run.h Mon Apr 3 03:15:31 2000 @@ -374,11 +374,18 @@ virtual UT_uint32 containsOffset(UT_uint32 iOffset); virtual const PP_AttrProp* getAP(void) const; virtual UT_Bool isSuperscript(void) const { return UT_FALSE; } - virtual UT_Bool isSubscript(void) const { return UT_FALSE; } + virtual UT_Bool isSubscript(void) const { return UT_FALSE; } protected: virtual void _draw(dg_DrawArgs*); virtual void _clearScreen(UT_Bool bFullLineHeightRect); + enum + { + TEXT_POSITION_NORMAL, + TEXT_POSITION_SUPERSCRIPT, + TEXT_POSITION_SUBSCRIPT + }; + UT_Byte m_fPosition; }; #endif /* FP_RUN_H */ diff -Naur --exclude=CVS abi/src/text/fmt/xp/fp_TextRun.cpp abi-cursorfix/src/text/fmt/xp/fp_TextRun.cpp --- abi/src/text/fmt/xp/fp_TextRun.cpp Thu Mar 30 02:21:59 2000 +++ abi-cursorfix/src/text/fmt/xp/fp_TextRun.cpp Mon Apr 3 03:11:48 2000 @@ -394,7 +394,6 @@ UT_sint32 yoff; UT_ASSERT(m_pLine); - m_pLine->getOffsets(this, xoff, yoff); const UT_GrowBuf * pgbCharWidths = m_pBL->getCharWidths()->getCharWidths(); const UT_uint16* pCharWidths = pgbCharWidths->getPointer(0); @@ -405,7 +404,6 @@ { xoff += pCharWidths[i]; } - if (m_fPosition == TEXT_POSITION_SUPERSCRIPT) { yoff -= m_iAscent * 1/2; @@ -418,6 +416,7 @@ x = xoff; y = yoff; height = m_iHeight; + } UT_Bool fp_TextRun::canMergeWithNext(void) @@ -1336,7 +1335,7 @@ return UT_FALSE; } -UT_Bool fp_TextRun::isSuperscript(void) const +UT_Bool fp_TextRun::isSuperscript(void) const { return (m_fPosition == TEXT_POSITION_SUPERSCRIPT); }