sw/source/uibase/docvw/edtwin.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit c071a7a312b14cee49cb779b02ac4a227a9fee66 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Jan 29 11:38:48 2021 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Feb 1 12:26:55 2021 +0100 don't scroll to cursor during GetSurroundingText lock against scrolling to cursor if the IM requests the surrounding text around the cursor seen on launching a menu from a sidebar comment's menubutton in writer if the cursor is a scroll-off page position in the main document Change-Id: I325004987f576df65188629bf6fb63e0ed0be9bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110135 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 67e0c6782943..9ad8275b7b1b 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6440,6 +6440,9 @@ OUString SwEditWin::GetSurroundingText() const rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR ); else if( !rSh.HasSelection() ) { + bool bUnLockView = !rSh.IsViewLocked(); + rSh.LockView(true); + SwPosition *pPos = rSh.GetCursor()->GetPoint(); const sal_Int32 nPos = pPos->nContent.GetIndex(); @@ -6453,6 +6456,9 @@ OUString SwEditWin::GetSurroundingText() const pPos->nContent = nPos; rSh.ClearMark(); rSh.HideCursor(); + + if (bUnLockView) + rSh.LockView(false); } return sReturn; @@ -6469,6 +6475,9 @@ Selection SwEditWin::GetSurroundingTextSelection() const } else { + bool bUnLockView = !rSh.IsViewLocked(); + rSh.LockView(true); + // Return the position of the visible cursor in the sentence // around the visible cursor. SwPosition *pPos = rSh.GetCursor()->GetPoint(); @@ -6482,6 +6491,9 @@ Selection SwEditWin::GetSurroundingTextSelection() const rSh.ClearMark(); rSh.ShowCursor(); + if (bUnLockView) + rSh.LockView(false); + return Selection( nPos - nStartPos, nPos - nStartPos ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits