gbranden pushed a commit to branch master
in repository groff.

commit e13adad51a61030ea87c3d0546cd794d5b03272c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jan 14 11:46:19 2025 -0600

    [man]: Fix Savannah #66664 (header crowding).
    
    * tmac/an.tmac (an*abbreviate-page-topic): (Actually, it's the
      _identifier_ we're abbreviating...)  Avoid crowding the middle header
      with a combination of line length and identifier text that is just
      right to exercise a corner case.
    
    Fixes <https://savannah.gnu.org/bugs/?66664>.
---
 ChangeLog    |  9 +++++++++
 tmac/an.tmac | 12 ++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 94157e865..c4380ff61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-01-14  G. Branden Robinson <[email protected]>
+
+       * tmac/an.tmac (an*abbreviate-page-topic): (Actually, it's the
+       _identifier_ we're abbreviating...)  Avoid crowding the middle
+       header with a combination of line length and identifier text
+       that is just right to exercise a corner case.
+
+       Fixes <https://savannah.gnu.org/bugs/?66664>.
+
 2025-01-14  G. Branden Robinson <[email protected]>
 
        [man]: Regression-test Savannah #66664.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index d9a297a7c..4992578a1 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1,6 +1,6 @@
 .\" groff implementation of man(7) package
 .\"
-.\" Copyright (C) 1989-2024 Free Software Foundation, Inc.
+.\" Copyright (C) 1989-2025 Free Software Foundation, Inc.
 .\"      Written by James Clark ([email protected])
 .\" Enhanced by: Werner Lemberg <[email protected]>
 .\"              Larry Kollar <[email protected]>
@@ -487,8 +487,11 @@
 .  \" PDF bookmarks.
 .  ds an*page-ref-string \\*[an*ident](\\*[an*section])\"
 .  ds an-pageref \\*[an*ident-abbv](\\*[an*section])\"
-.  nr an-header-width \\w'\\*[an-pageref]\\*[an-extra3]\\*[an-pageref]'
-.  while (\\n[an-header-width] >= \\n[.lt]) \{\
+.  \" Computer width of title text, plus 2n for minimal spacing on
+.  \" either side of the center header.
+.  nr an-header-width \
+     (\\w'\\*[an-pageref]\\*[an-extra3]\\*[an-pageref]' + 2n)
+.  while (\\n[an-header-width] > \\n[.lt]) \{\
 .    \" The page topic is too long; trim some bits out of the middle.
 .    length an*ident-length \\*[an*ident-string]
 .    \" roff uses truncating division.  Remove an additional character
@@ -510,8 +513,9 @@
 .    ie (\\n[an*ident-new-length] >= \\n[an*ident-length]) \
 .      break
 .    ds an-pageref \\*[an*ident-abbv](\\*[an*section])\"
+.    \" Recompute header width now that it's shorter.
 .    nr an-header-width \
-       \\w'\\*[an-pageref]\\*[an-extra3]\\*[an-pageref]'
+       (\\w'\\*[an-pageref]\\*[an-extra3]\\*[an-pageref]' + 2n)
 .  \}
 .  ds an-pageref \\*[an-lic]\f[\\*[MF]]\\*[an*ident-abbv]\\*[an-ic]\
 \f[R](\\*[an*section])\"

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

Reply via email to