sw/source/core/crsr/crsrsh.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit ab2b0bd10481e9d0bb5bfea09ab0b034bb246c52 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jan 18 14:29:06 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Jan 18 17:43:43 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 <michael.st...@allotropia.de> diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 9448533ff75d..15883b2a80e2 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2939,6 +2939,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 @@ -2954,8 +2955,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())