From 5bc7d0186d1a70990377a2f4c630fe11e2dfd166 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 16 Dec 2023 11:10:28 -0500 Subject: tdf#111969 sw: acknowledge that last half-character in Get*Correction This fixes right-clicking on the last half-character of a mis-spelled word, which previously did not pull up a spelling suggestion list. This is a suggested follow-up to right-clicking on a selection, which had the same problem. Probably everywhere that calls GetModelPositionForViewPoint without eTmpState.m_bPosMatchesBounds should be suspected of being wrong. Patchset 2 contains a unit test that ONLY passes on machines that have spell checking dictionaries on them. The concept in general is already tested is another patch, so I'll just drop this unit test that checks the spell-checking code path. It would easily break other people's development setups if they don't have en-US dictionaries. Change-Id: I3faa87d16eb3452f863052ea851a43a871125060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160872 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/source/core/edit/edlingu.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sw') diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 5731d2b2be49..e1bcd3f23520 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -915,6 +915,7 @@ uno::Reference< XSpellAlternatives > SwPaM* pCursor = GetCursor(); SwPosition aPos( *pCursor->GetPoint() ); SwCursorMoveState eTmpState( CursorMoveState::SetOnlyText ); + eTmpState.m_bPosMatchesBounds = true; // treat last half of character same as first half SwTextNode *pNode = nullptr; SwWrongList *pWrong = nullptr; if (pPt && GetLayout()->GetModelPositionForViewPoint( &aPos, *const_cast(pPt), &eTmpState )) @@ -986,6 +987,7 @@ bool SwEditShell::GetGrammarCorrection( SwPaM* pCursor = GetCursor(); SwPosition aPos( *pCursor->GetPoint() ); SwCursorMoveState eTmpState( CursorMoveState::SetOnlyText ); + eTmpState.m_bPosMatchesBounds = true; // treat last half of character same as first half SwTextNode *pNode = nullptr; SwGrammarMarkUp *pWrong = nullptr; if (pPt && GetLayout()->GetModelPositionForViewPoint( &aPos, *const_cast(pPt), &eTmpState )) -- cgit