Bug 167538 - An empty final line of a paragraph, created by a hard line break, has no line number with line numbering activated
Summary: An empty final line of a paragraph, created by a hard line break, has no line...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:26.2.0
Keywords:
Depends on:
Blocks: Line-Numbering
  Show dependency treegraph
 
Reported: 2025-07-17 10:12 UTC by Mike Kaganski
Modified: 2025-07-17 17:25 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2025-07-17 10:12:03 UTC
1. Create a new Writer document.
2. In Tools->Line Numbering, set Show numbering, interval 1, count blank lines.
   => See that there is "1" at the first line now.
3. Press Shift + Enter to insert a line break.
   => There is no "2" next to the new line.
4. Press Enter
   => There is "3" at the new paragraph, but the line above is still missing the line number.
Comment 1 Mike Kaganski 2025-07-17 10:18:28 UTC
The problem is, that the empty paragraph line is considered a "dummy"; it is decided in SwLineLayout::CalcLine, and checked in SwTextFrame::PaintExtraData.

There is a similar check in SwTextFormatter::CalcRealHeight; there, it accounts for trailing line created in the end of a paragraph by a line break.
Comment 2 Mike Kaganski 2025-07-17 15:49:13 UTC
https://gerrit.libreoffice.org/c/core/+/188016
Comment 3 Commit Notification 2025-07-17 17:25:41 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5355b3ec3925ddd146a6e3dd6ba28a816b39c66c

tdf#167538, tdf#167540: better check if the line is dummy

It will be available in 26.2.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.