sw/source/core/text/itrcrsr.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
New commits: commit 76094232350d01ab7dabdc8f7c0043fa5c6ff4c8 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Dec 30 15:00:07 2023 +0600 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Dec 30 11:09:44 2023 +0100 No need to decrement the position for Hole portion case Otherwise a click to the right of a centered paragraph in DOCX with trailing spaces would put cursor before the last space, not after. Change-Id: Idc0cb1b69f7271e1f9af2e23389aaf11adcbd186 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161438 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 6da37f66a5de..30b605cac011 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1364,7 +1364,6 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con // in which nX is situated. SwLinePortion *pPor = m_pCurr->GetFirstPortion(); TextFrameIndex nCurrStart = m_nStart; - bool bHolePortion = false; bool bLastHyph = false; std::deque<sal_uInt16> *pKanaComp = m_pCurr->GetpKanaComp(); @@ -1419,7 +1418,6 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con { nX = nX - nWidth; nCurrStart = nCurrStart + pPor->GetLen(); - bHolePortion = pPor->IsHolePortion(); pPor = pPor->GetNextPortion(); nWidth = pPor->Width(); if ( m_pCurr->IsSpaceAdd() || pKanaComp ) @@ -1520,7 +1518,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con return TextFrameIndex(0); // 7849, 7816: pPor->GetHyphPortion is mandatory! - if( bHolePortion || ( !bRightAllowed && bLastHyph ) || + if( ( !bRightAllowed && bLastHyph ) || ( pPor->IsMarginPortion() && !pPor->GetNextPortion() && // 46598: Consider the situation: We might end up behind the last character, // in the last line of a centered paragraph
