[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 1 11:27:30 UTC 2021
sw/source/uibase/docvw/edtwin.cxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit c071a7a312b14cee49cb779b02ac4a227a9fee66
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 29 11:38:48 2021 +0000
Commit: Michael Stahl <michael.stahl at 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.stahl at 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 );
}
}
More information about the Libreoffice-commits
mailing list