Created attachment 194492 [details] Page width 120 cm, wraps at 4 mm If the page width in Writer is set wider than 119 cm then the text starts wrapping before the the right hand page margin. An extreme example, at a page width of 120 cm, the line wraps at approximately 4 mm, see attached Writer document. The point at which the text starts wrapping varies with page width beyond 119 cm Earliest tested on 6.4.7.2 Expectation: The text should continue to the right hand margin Issue arose recently in https://ask.libreoffice.org/t/ultra-wide-document/106370 Also, earlier in https://ask.libreoffice.org/t/libreoffice-writer-possible-bug-format-page/40120
Almost definitely an integer overflow. 65536 twip is 115.6 cm; add 2 x 2 cm margins, and you get 119.6 cm (and then, 120 cm - 119.6 cm gives the 4 mm). A tentative code pointer: sal_uInt16 SwTextFormatInfo::Width() in sw/source/core/text/inftxt.hxx (and many other cases of use of sal_uInt16 e.g. in sw/source/core/text/itrform2.cxx).
i#34348 already changed *some* fields in SwTextFormatInfo from sal_uInt16, so putting that to See Also.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7e9c23894bd45e015accf26ae0a77035b7eed452 tdf#161368: use SwTwips for twip sizes, instead of sal_uInt16 It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.