Follow-up Comment #2, bug #68555 (group groff):

My initial patch was insufficient to preserve functionality.

Here's a better one.


diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 6387be2d0..f75ab194c 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -4188,25 +4188,25 @@ static void print_hyphenation_exceptions_request() //
.phw
     string word = entry.contents();
     (void) memset(wordbuf, '\0', bufsz);
     size_t i = 0, j = 0, len = word.length();
-    bool is_mode_dependent = false;
-    if (*hypoint != 0) {
+    if (0 == *hypoint) {
+      // `word` has no hyphenation points.
+      (void) strncpy(wordbuf, word.contents(), len);
+      wordbuf[len] = '\0';
+    }
+    else {
       while (i < len) {
        if ((hypoint != 0 /* nullptr */) && (*hypoint == i)) {
          wordbuf[j++] = '-';
          hypoint++;
        }
-       // The exception word symbol's contents contains a space if it's
-       // _not_ user-defined.  See
-       // `remove_hyphenation_exception_words_request()` above.
-       if (word[i] == ' ') {
-         assert(i == (len - 1));
-         is_mode_dependent = true;
-       }
        wordbuf[j++] = word[i++];
       }
     }
     errprint("%1", wordbuf);
-    if (is_mode_dependent)
+    // The exception word symbol's contents contains a space if it's
+    // _not_ user-defined.  See
+    // `remove_hyphenation_exception_words_request()` above.
+    if (word[len - 1] == ' ')
       errprint("\t*");
     errprint("\n");
   }




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68555>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to