URL: <https://savannah.gnu.org/bugs/?67231>
Summary: [troff] applying `length` request to macro causes
spurious output
Group: GNU roff
Submitter: gbranden
Submitted: Mon 23 Jun 2025 03:37:56 AM GMT
Category: Core
Severity: 3 - Normal
Item Group: Incorrect behaviour
Status: In Progress
Privacy: Public
Assigned to: gbranden
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Mon 23 Jun 2025 03:37:56 AM GMT By: G. Branden Robinson <gbranden>
The `length` request, in non-erroneous scenarios, ends with `tok.next()`
before returning, not `skip_line()`. As a rule, **all** request handlers
should `skip_line()` before returning.
When measuring the length of a macro or diversion using string interpolation,
and the macro or diversion ends with a newline (as they typically do if you
don't go after them with `chop`), that puts the newline on the output.
Problem observed in _groff_ Git HEAD, 1.23.0, 1.22.4, and 1.22.3; it appears
to date back to `length`'s birth in commit 704d2efdf4, 11 February 2000.
There is a separate but closely related problem with `length`, which I will
file as a separate ticket.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?67231>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
