sw/qa/extras/layout/layout2.cxx | 13 ++++++++----- sw/source/core/text/itrcrsr.cxx | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-)
New commits: commit 3c4b09a250605c9d73e48df83a6ee36a8bc2fb8b Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Nov 12 13:44:16 2020 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Nov 23 11:13:18 2020 +0100 tdf#120290 sw: comment no longer needs any width Way back in 2001 with commit dca044e9572144c1ba9ce423b10f7a5456837cda, Fix #93831#: Larger range for tip help on notes, comments were called Notes, and looked similar to Calc's comments - just a tooltip kind of note that you hover over. Adding some fake space to the comment anchor probably helped to get access to that note. But now that comments are always visible in a side panel, there doesn't seem to be any need to pretend that the comment anchor takes up any space, which fixes a few corner cases where that fake width exceeded the real width of small portions that followed. Change-Id: I4e9dac12dce0545e0ac79e46597f6e441dc066a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105747 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index fad78d5bb7ea..f5b42ee947ed 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -1910,11 +1910,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testCommentCursorPosition) pTextFrame->GetModelPositionForViewPoint(&aPosition, aPoint); // Without the accompanying fix in place, this test would have failed with: - // - Expected: 4 (six would be even better...) - // - Actual : 3 - // i.e. the cursor got positioned before the first comment, - // so typing extended the comment instead of adding content after the comment. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aPosition.nContent.GetIndex()); + // - Expected: 6 + // - Actual : 3 or 4 + // i.e. the cursor got positioned before the comments, + // so typing extended the first comment instead of adding content after the comments. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6), aPosition.nContent.GetIndex()); + // The second line is also important, but can't be auto-tested + // since the failing situation depends on GetViewWidth which is zero in the headless tests. + // bb<comment>| - the cursor should move behind the |, not before it. } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf64222) diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 7a6e1d3cdd03..6835ff41fa12 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1366,7 +1366,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con sal_uInt16 nWidth30; if ( pPor->IsPostItsPortion() ) - nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2; + nWidth30 = 0; else nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFieldGrp() ? 30 : @@ -1410,7 +1410,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con } if ( pPor->IsPostItsPortion() ) - nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2; + nWidth30 = 0; else nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFieldGrp() ? 30 : _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits