Follow-up Comment #13, bug #66919 (group groff): Bear in mind that "bad" is merely a label. In this case it refers to the change from _groff_ 1.23.0 and earlier behavior.
a52141ac46eef95dd1f85e4c2e0a336affa9bcc9 is the first bad commit commit a52141ac46eef95dd1f85e4c2e0a336affa9bcc9 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Thu Aug 8 06:53:23 2024 -0500 [troff]: Continue fixing Savannah #66054. * src/roff/troff/input.cpp (set_hyphenation_codes): Handle the common case (copying the existing hyphenation code of one character to another) first. Support clearing a character's hyphenation code by copying that of a character that lacks one. Reorganize for clarity, and add comments. Continues fixing <https://savannah.gnu.org/bugs/?66054>. ChangeLog | 10 ++++++++++ src/roff/troff/input.cpp | 23 ++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) In this case, the change is deliberate: "Support clearing a character's hyphenation code by copying that of a character that lacks one." Here's the entire diff (of "input.cpp"). diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index cc7d9dd71..946b93570 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -7309,25 +7309,26 @@ static void set_hyphenation_codes() error("cannot use the hyphenation code of a numeral"); break; } - unsigned char new_code = 0; // TODO: int + unsigned char new_code = 0; charinfo *cisrc = tok.get_char(); - if (csrc != 0) - new_code = csrc; - else { + if (cisrc != 0 /* nullptr */) + // Common case: assign destination character the hyphenation code + // of the source character. + new_code = cisrc->get_hyphenation_code(); + if (0 == csrc) { if (0 /* nullptr */ == cisrc) { error("expected ordinary or special character, got %1", tok.description()); break; } - // source character is special - if (0 == cisrc->get_hyphenation_code()) { - error("second member of hyphenation code pair must be an" - " ordinary character, or a special character already" - " assigned a hyphenation code"); - break; - } new_code = cisrc->get_hyphenation_code(); } + else { + // If assigning a ordinary character's hyphenation code to itself, + // use its character code point as the value. + if (csrc == cdst) + new_code = tok.ch(); + } cidst->set_hyphenation_code(new_code); if (cidst->get_translation() && cidst->get_translation()->get_translation_input()) _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66919> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature