gbranden pushed a commit to branch master
in repository groff.

commit f66f771c22690f5f0e6dec3c9a53adb7243bb7fe
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Aug 1 18:16:19 2024 -0500

    [troff]: Fix Savannah #66054 (hcode & spec chars).
    
    * src/roff/troff/input.cpp (set_hyphenation_codes): Accept a special
      character as a source for hyphenation code assignment.
    
    * doc/groff.texi.in (Manipulating Hyphenation) <hcode>:
    * man/groff_diff.7.man (New requests) <hcode>: Document loosened
      restriction.
    
    Fixes <https://savannah.gnu.org/bugs/?66054>.  Thanks to Carsten Kunze
    for the report and Dave Kemper for a test case that clarified matters.
---
 ChangeLog                | 13 +++++++++++++
 doc/groff.texi.in        |  5 +++--
 man/groff_diff.7.man     |  4 +++-
 src/roff/troff/input.cpp |  9 ++++++---
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5f4b2213a..496be617a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-07-31  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (set_hyphenation_codes): Accept a
+       special character as a source for hyphenation code assignment.
+
+       * doc/groff.texi.in (Manipulating Hyphenation) <hcode>:
+       * man/groff_diff.7.man (New requests) <hcode>: Document loosened
+       restriction.
+
+       Fixes <https://savannah.gnu.org/bugs/?66054>.  Thanks to Carsten
+       Kunze for the report and Dave Kemper for a test case that
+       clarified matters.
+
 2024-07-31  G. Branden Robinson <[email protected]>
 
        Regression-test Savannah #66054.
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index f77025250..7b8dd189d 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -8985,8 +8985,9 @@ patterns contain them.
 Set the hyphenation code of ordinary or special character @var{dst1} to
 that of @var{src1}, and so on.  @var{dst1} must be an ordinary character
 (other than a numeral) or a special character, and @var{src1} must be an
-ordinary character (other than a numeral).  Assigning the code of an
-ordinary character code to itself effectively creates a unique
+ordinary character (other than a numeral) or a special character to
+which a hyphenation code has already been applied.  Assigning the code
+of an ordinary character code to itself effectively creates a unique
 hyphenation code (which can then be copied to others).  @code{hcode}
 ignores spaces between arguments.  If any argument is invalid,
 @code{hcode} reports an error and stops reading them.
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 32f4dc0c3..f4ab749f7 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -2619,7 +2619,9 @@ or a special character,
 and
 .I src1
 must be an ordinary character
-(other than a numeral).
+(other than a numeral)
+or a special character
+to which a hyphenation code has already been applied.
 .
 Assigning the code of an ordinary character to itself
 effectively creates a unique hyphenation code
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index c5eaa52de..4f2c89c71 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7319,9 +7319,12 @@ static void set_hyphenation_codes()
        break;
       }
       // source character is special
-      error("second member of hyphenation code pair must be an"
-           " ordinary character");
-      break;
+      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();
     }
     cidst->set_hyphenation_code(new_code);

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to