[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jan 30 10:37:33 UTC 2021
sw/source/uibase/docvw/edtwin.cxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit 6792aa49a5a7eba601693734a164ab45042c580b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 29 11:38:48 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Jan 30 11:36:50 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/+/110153
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 143a3259a991..cfef52b581d4 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6461,6 +6461,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();
@@ -6474,6 +6477,9 @@ OUString SwEditWin::GetSurroundingText() const
pPos->nContent = nPos;
rSh.ClearMark();
rSh.HideCursor();
+
+ if (bUnLockView)
+ rSh.LockView(false);
}
return sReturn;
@@ -6490,6 +6496,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();
@@ -6503,6 +6512,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