diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-18 14:29:06 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-18 17:43:43 +0100 |
commit | ab2b0bd10481e9d0bb5bfea09ab0b034bb246c52 (patch) | |
tree | 8545a90e723ca26a1538e9dcc80be4b408a46649 /sw/source/core/crsr/crsrsh.cxx | |
parent | 403ba351302a0bf95a6f4dcc0cb0e675f593d3e2 (diff) |
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.stahl@allotropia.de>
Diffstat (limited to 'sw/source/core/crsr/crsrsh.cxx')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
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()) |