sw/source/core/crsr/crstrvl.cxx | 1 + sw/source/core/text/itrcrsr.cxx | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-)
New commits: commit 062b4bee5eb06483cef3dde3f28a5d12599840d3 Author: Justin Luth <jl...@mail.com> AuthorDate: Tue Dec 19 15:32:15 2023 -0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jan 5 14:44:51 2024 +0100 tdf#111969 sw: acknowledge that last half-character for popup/pointer This fixes WHEN the helpful pop-up notifies about the cursor being over top of a smart-tag, and suggesting that the user can CTRL-clicking to activate the smart tag. Prior to this patch, it would start half-a-character too soon, and end half-a-character too early. It similarly fixes WHEN the helpful cursor pointer changes into a finger when holding ctrl and moving into the start or end of the smarttag. Smart tags REQUIRE a plugin, so a unit test is out of the question. The impact could be MUCH LARGER than just smart tags, but they were the impetus for the change, because smart tags are not portions while the other things (redlines, fields, refs/footnotes, formulas) are. The net effect on other IsAttrAtPos SHOULD be nothing, so that still doesn't leave me with anything unit testable. If I ONLY removed the --index from itrcrsr, then unit tests in uiwriter9 fail. Adding aTmpState.m_bPosMatchesBounds = true (which is the fix for smart tags) makes it not fail. Adding bPosMatchesBounds OUGHT to obsolete an initial-import --index hack? While I don't NEED to remove the (what looks to me) hack (and it actually is super dangerous to remove it) I really think it is obsolete and thus deserves removal. Easy to restore if it proves a regression... So bFieldInfo and bPosMatchesBounds end up doing much of the same thing. This is one of only two places which sets m_bFieldInfo = true, the other being a EnhancedPDFExportHelper.cxx which tests pEnd inclusively. cms.m_bFieldInfo = true; auto const [pStart, pEnd] = rShell.GetCursor_()->StartEnd(); if (rShell.GetLayout()->GetModelPositionForViewPoint(&pos, center, &cms) && *pStart <= pos && pos <= *pEnd) make CppunitTest_vcl_pdfexport CPPUNIT_TEST_NAME=testTdf157816 is not a good test for this - it passes without --index and !FieldInfo Change-Id: I77df5e054879eb3bbc82907962b77386811bceac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161034 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 01899b6bdde3..c886ffb6572c 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1462,6 +1462,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos ); aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); + aTmpState.m_bPosMatchesBounds = true; // treat last half of character same as first half SwSpecialPos aSpecialPos; aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ? diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 7a74df60c990..0cb12bf54a21 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1811,12 +1811,6 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con } nLength = TextFrameIndex(0); } - else if (bFieldInfo && nLength == pPor->GetLen() && - (! pPor->GetNextPortion() || - ! pPor->GetNextPortion()->IsPostItsPortion())) - { - --nLength; - } // set cursor bidi level if ( pCMS )