Created attachment 47713 [details] propose fix If the last line is empty, and consists of only the field-end char then... we have... if ( ch == CH_TXT_ATR_FIELDEND ) SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos - 1 ) ); ... so taking the sample .doc attached, load it, place cursor on second line of field and delete the single space in it, save it => crash when looking at the CH_TXT_ATR_FIELDEND char we're at position 0 in that SwNode, getting nAktPos-1 to look at the content before the field-end is busted, because it assumes that the previous char is in the same SwNode, so we get an invalid -1 pos in the current node, not the last pos in the previous node. Looking at MarkBase::IsCoveringPosition I see that we currently have... return GetMarkStart() <= rPos && rPos < GetMarkEnd(); which suggests that the starting CH_TXT_ATR_FIELDBEGIN char is considered part of the coveredrange, but that the FIELDEND is not. How about keeping it simple and consider both the field start and end chars as part of the range.
Created attachment 47714 [details] sample document
Talking about DOC export, this issue is (at least at the surface) a Writer issue, therefore changed the 'Component' field accordingly.
Caolan McNamara committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4f526e08cfe9f938aa3422da80dc60f2e1ec3da Resolves: fdo#38071 improve multi-line form field text ranges
Michael Stahl committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=f2b6d71ccd04f41a849a0e5386f6619bfcc211da fdo#38071: roll back change to MarkBase::IsCoveringPosition:
Michael Stahl committed a patch related to this issue. It has been pushed to "libreoffice-3-6": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6497a45560fa34d7f1372412c0994632ec7ff75b&g=libreoffice-3-6 fdo#38071: roll back change to MarkBase::IsCoveringPosition: It will be available in LibreOffice 3.6.