From 2b0a7c346f8e3c5823a9e032a4501f20bc712914 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 5 Jul 2018 15:58:05 +0200 Subject: tdf#118414 sw: fix fieldmarks in GetNextAttr() Apparently this needs to stop both before and after the CH_TXT_ATR_*. (regression from 3e724847308c0d9cdd727898faaeb347c5f0643a) Change-Id: Iff3d594d2eec59436ad683b9cc7aca04f7527bd5 Reviewed-on: https://gerrit.libreoffice.org/57017 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/text/itratr.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index d1f77e062ee9..b6e53480d6e4 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -674,9 +674,11 @@ static sal_Int32 GetNextAttrImpl(SwTextNode const*const pTextNode, } } assert(p <= nNext); - if (p < l && nPosition < p) + if (p < l) { - nNext=p; + // found a CH_TXT_ATR_FIELD*: if it's same as current position, + // skip behind it so that both before- and after-positions are returned + nNext = (nPosition < p) ? p : p + 1; } return nNext; } -- cgit