sw/source/core/crsr/crsrsh.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit 53d8675436cb500adff0f9f6aa0063b9c00962dd Author: Michael Stahl <[email protected]> AuthorDate: Thu Jan 18 14:29:06 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sat Jan 20 17:41:34 2024 +0100 tdf#139631 sw_redlinehide: fix IntelligentCut feature with redlines Unfortunately forgot to adapt SwCursorShell::GetChar() to use the SwTextFrame instead of the SwTextNode, so it returns non-visible (deleted) characters to SwWrtShell::IntelligentCut(), breaking one of our oldest AI features. (regression from sw_redlinehide) Change-Id: I0c19944159e7e3af323bfe626c0e496ad745ef35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162253 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit ab2b0bd10481e9d0bb5bfea09ab0b034bb246c52) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162271 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 04b263cda754..173414ed4db7 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2936,6 +2936,7 @@ OUString SwCursorShell::GetSelText() const } /** get the nth character of the current SSelection + in the same paragraph as the start/end. @param bEnd Start counting from the end? From start otherwise. @param nOffset position of the character @@ -2951,8 +2952,14 @@ sal_Unicode SwCursorShell::GetChar( bool bEnd, tools::Long nOffset ) if( !pTextNd ) return 0; - const sal_Int32 nPos = pPos->GetContentIndex(); - const OUString& rStr = pTextNd->GetText(); + SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTextNd->getLayoutFrame(GetLayout()))); + if (!pFrame) + { + return 0; + } + + const sal_Int32 nPos(sal_Int32(pFrame->MapModelToViewPos(*pPos))); + const OUString& rStr(pFrame->GetText()); sal_Unicode cCh = 0; if (((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.getLength())
