sw/source/core/crsr/swcrsr.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
New commits: commit d1655a9a565dd629741c7dd3b0462a7900f067e3 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Apr 15 16:58:55 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Thu Apr 16 12:40:28 2020 +0200 tdf#132091 sw: fix fieldmark mess in SwCursor::SelectWordWT() The problem is that it selects both the field instruction and the field result; in the typical case where the instruction is empty, the separator won't be deleted (due to CalcBreaks) but the problem is that the cursor ends up before the separator, not after it. Also remove some silly defensive programming. (regression from ffb26b81e1c7ff1d64959200247bb2edd5a569da) Change-Id: I80b6cb1790b7102828f12b680631f928734ffa7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92284 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 1c94842e053a20a739a181d38a35c324df3e62a7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92293 Reviewed-by: Vasily Melenchuk <vasily.melenc...@cib.de> diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 5509b9f33027..92b4e941876e 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -28,6 +28,7 @@ #include <swtblfmt.hxx> #include <swcrsr.hxx> #include <unocrsr.hxx> +#include <bookmrk.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentRedlineAccess.hxx> @@ -1403,23 +1404,20 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType { // Should we select the whole fieldmark? const IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); - sw::mark::IMark* pMark = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : nullptr; + sw::mark::IFieldmark const*const pMark(pMarksAccess->getFieldmarkFor(*GetPoint())); if ( pMark ) { - const SwPosition& rStart = pMark->GetMarkStart(); - GetPoint()->nNode = rStart.nNode; - GetPoint()->nContent = rStart.nContent; - ++GetPoint()->nContent; // Don't select the start delimiter + *GetPoint() = sw::mark::FindFieldSep(*pMark); + ++GetPoint()->nContent; // Don't select the separator const SwPosition& rEnd = pMark->GetMarkEnd(); - if ( rStart != rEnd ) - { - SetMark(); - GetMark()->nNode = rEnd.nNode; - GetMark()->nContent = rEnd.nContent; - --GetMark()->nContent; //Don't select the end delimiter - } + assert(pMark->GetMarkEnd() != *GetPoint()); + SetMark(); + GetMark()->nNode = rEnd.nNode; + GetMark()->nContent = rEnd.nContent; + --GetMark()->nContent; // Don't select the end delimiter + bRet = true; } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits