groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/05: [troff]: Don't adjust nonadjustable lines.


From: G. Branden Robinson
Subject: [groff] 04/05: [troff]: Don't adjust nonadjustable lines.
Date: Sat, 4 Sep 2021 11:21:48 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 69efbe0a69a8e7de8904d78e3de8c7e8a58a8b92
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Sep 4 23:20:54 2021 +1000

    [troff]: Don't adjust nonadjustable lines.
    
    This means that the direction from which an output line in adjustment
    mode "b" (or its "n" synonym) is filled with supplemental space is not
    changed if that output line does not require adjustment.  This will
    result in whitespace changes to documents using that adjustment mode,
    and these changes will be plainly visible on low-resolution output
    devices like terminals.
    
    To illustrate, in the following "A" means an output line requiring
    adjustment; "F" a line that is "full" and does not; and "L" and "R"
    indicate distribution of adjustment spaces from the left and right,
    respectively.
    
    groff 1.22.4    groff 1.23.0
    ------------    ------------
    A    L          A    L
    A    R          A    R
    F    L          F    R
    A    R          A    L
    
    * src/roff/troff/env.cpp (distribute_space): Return early if either the
      amount of desired space to be distributed or the count of space nodes
      in the output line to distribute it among is zero.
    
    * tmac/tests/an_TH-repairs-ad-damage.sh: Update test to expect space to
      be distributed differently.
    
    Fixes <https://savannah.gnu.org/bugs/?61089> and
    <https://savannah.gnu.org/bugs/index.php?60673>.
---
 ChangeLog                             | 33 +++++++++++++++++++++++++++++++++
 src/roff/troff/env.cpp                |  3 ++-
 tmac/tests/an_TH-repairs-ad-damage.sh |  2 +-
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5a8caeb..3a30bac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,38 @@
 2021-09-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       [troff]: Don't adjust nonadjustable lines.  This means that the
+       direction from which an output line in adjustment mode "b" (or
+       its "n" synonym) is filled with supplemental space is not
+       changed if that output line does not require adjustment.  This
+       will result in whitespace changes to documents using that
+       adjustment mode, and these changes will be plainly visible on
+       low-resolution output devices like terminals.
+
+       To illustrate, in the following "A" means an output line
+       requiring adjustment; "F" a line that is "full" and does not;
+       and "L" and "R" indicate distribution of adjustment spaces from
+       the left and right, respectively.
+
+       groff 1.22.4    groff 1.23.0
+       ------------    ------------
+       A    L          A    L
+       A    R          A    R
+       F    L          F    R
+       A    R          A    L
+
+       * src/roff/troff/env.cpp (distribute_space): Return early if
+       either the amount of desired space to be distributed or the
+       count of space nodes in the output line to distribute it among
+       is zero.
+
+       * tmac/tests/an_TH-repairs-ad-damage.sh: Update test to expect
+       space to be distributed differently.
+
+       Fixes <https://savannah.gnu.org/bugs/?61089> and
+       <https://savannah.gnu.org/bugs/index.php?60673>.
+
+2021-09-04  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        Skip core-dump-checking test if a core file already exists.
 
        * src/roff/groff/tests/regression_savannah_59202.sh: Skip test
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 4af8741..fbb4429 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2053,6 +2053,8 @@ static node *node_list_reverse(node *n)
 static void distribute_space(node *n, int nspaces, hunits desired_space,
                             int force_reverse = 0)
 {
+  if (desired_space.is_zero() || nspaces == 0)
+    return;
   static int reverse = 0;
   if (force_reverse || reverse)
     n = node_list_reverse(n);
@@ -2070,7 +2072,6 @@ static void distribute_space(node *n, int nspaces, hunits 
desired_space,
     (void)node_list_reverse(n);
   if (!force_reverse)
     reverse = !reverse;
-  assert(desired_space.is_zero() && nspaces == 0);
 }
 
 void environment::possibly_break_line(int start_here, int forced)
diff --git a/tmac/tests/an_TH-repairs-ad-damage.sh 
b/tmac/tests/an_TH-repairs-ad-damage.sh
index 225d5e0..7b2c849 100755
--- a/tmac/tests/an_TH-repairs-ad-damage.sh
+++ b/tmac/tests/an_TH-repairs-ad-damage.sh
@@ -36,6 +36,6 @@ Innocent, unoffending man page enjoys adjustment to both 
margins.
 Innocent, unoffending man page enjoys adjustment to both margins.'
 
 OUTPUT=$(printf "%s\n" "$EXAMPLE" | "$groff" -Tascii -P-cbou -man)
-echo "$OUTPUT" | grep -qE 'margins\.   In' # three spaces
+echo "$OUTPUT" | grep -qE 'margins\.  In' # two spaces
 
 # vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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