summaryrefslogtreecommitdiffstats
path: root/sw/source/core/crsr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:29:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:29:03 +0000
commit5a7157d319477830426797532e02ac39d3b859f4 (patch)
tree3773f5ce209bee14a5643e98672e0f3828c71434 /sw/source/core/crsr
parentReleasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff)
downloadlibreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz
libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/source/core/crsr')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx11
-rw-r--r--sw/source/core/crsr/crstrvl.cxx1
2 files changed, 10 insertions, 2 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 04b263cda7..173414ed4d 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())
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index db11d4ea33..81323787d7 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -600,6 +600,7 @@ const SwTOXMark& SwCursorShell::GotoTOXMark( const SwTOXMark& rStart,
SwPosition& rPos = *GetCursor()->GetPoint();
rPos.Assign(rNewMark.GetTextTOXMark()->GetTextNode(),
rNewMark.GetTextTOXMark()->GetStart() );
+ GetCursor()->DeleteMark(); // tdf#158783 prevent UpdateCursor resetting point
if( !m_pCurrentCursor->IsSelOvr() )
UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE |