summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-29 11:09:46 +0100
committerAndras Timar <andras.timar@collabora.com>2020-08-02 10:32:10 +0200
commit3940ff6a201cc0e6d13bcd49d7105f07a17be992 (patch)
tree990a11088a0219aef2eeff11456ea60cb56d66b9 /cui
parenta1d0c7f74099f52ea7ee2d708cf0c91d24e8ef28 (diff)
tdf#133958 only move the selection to the error if its not already there
Change-Id: I3046c842cc6c8bcc867c79989a8978d382b08269 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99607 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 8c55ee12a72f..2d803556e402 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1672,8 +1672,17 @@ void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd,
aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL));
m_xEditEngine->QuickSetAttribs(aSet, ESelection(0, nStart, 0, nEnd));
- // so the editview will autoscroll to make this visible
- m_xEditView->SetSelection(ESelection(0, nStart));
+
+ // Set the selection so the editview will autoscroll to make this visible
+ // unless (tdf#133958) the selection already overlaps this range
+ ESelection aCurrentSelection = m_xEditView->GetSelection();
+ aCurrentSelection.Adjust();
+ bool bCurrentSelectionInRange = nStart <= aCurrentSelection.nEndPos && aCurrentSelection.nStartPos <= nEnd;
+ if (!bCurrentSelectionInRange)
+ {
+ m_xEditView->SetSelection(ESelection(0, nStart));
+ }
+
Invalidate();
m_nErrorStart = nStart;