groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 03/14: Fix Savannah #61348.


From: G. Branden Robinson
Subject: [groff] 03/14: Fix Savannah #61348.
Date: Wed, 20 Oct 2021 00:52:50 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 45293d589293cf4d938aebdd4812926956ec36ea
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Oct 19 13:30:29 2021 +1100

    Fix Savannah #61348.
    
    * src/roff/troff/env.cpp (distribute_space): Revert an `assert()` I
      added in commit b93eacd8d7 (5 September); we can indeed reach this
      code with a negative amount of desired space, and in fact the "show
      hyphenation points" trick
      <https://froude.eu/groff/examples/hyphenation-points.html> relies upon
      it.  Add explanatory comment.
    
    Fixes <https://savannah.gnu.org/bugs/?61348>.
---
 ChangeLog              | 11 +++++++++++
 src/roff/troff/env.cpp |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0989802..7b9ef38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-10-19  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/env.cpp (distribute_space): Revert an
+       `assert()` I added in commit b93eacd8d7 (5 September); we can
+       indeed reach this code with a negative amount of desired space,
+       and in fact the "show hyphenation points" trick
+       <https://froude.eu/groff/examples/hyphenation-points.html>
+       relies upon it.  Add explanatory comment.
+
+       Fixes <https://savannah.gnu.org/bugs/?61348>.
+
 2021-10-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * test-groff.in: Add support for sboxes.tmac.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 14d45e1..e6fc03a 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2058,9 +2058,10 @@ static void distribute_space(node *n, int nspaces, 
hunits desired_space,
 {
   if (desired_space.is_zero() || nspaces == 0)
     return;
+  // Positive desired space is the typical case.  Negative desired space
+  // is possible if we have overrun an unbreakable line.  But we should
+  // not get here if there are no adjustable space nodes to adjust.
   assert(nspaces > 0);
-  // Negative desired space is conceivable if we implement "squeezing".
-  assert(desired_space > 0);
   // Space cannot always be distributed evenly among all of the space
   // nodes in the node list: there are limits to device resolution.  We
   // add space until we run out, which might happen before the end of



reply via email to

[Prev in Thread] Current Thread [Next in Thread]