sw/source/core/edit/edlingu.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 5bc7d0186d1a70990377a2f4c630fe11e2dfd166
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Sat Dec 16 11:10:28 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Dec 18 15:11:30 2023 +0100

    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 <jl...@mail.com>

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<Point*>(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<Point*>(pPt), &eTmpState ))

Reply via email to