groff-commit
[Top][All Lists]
Advanced

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

[groff] 29/40: [man]: Fix link text formatting problem.


From: G. Branden Robinson
Subject: [groff] 29/40: [man]: Fix link text formatting problem.
Date: Sat, 12 Nov 2022 14:43:39 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 346de1cf796dae220e530ffae9b37b60c1709fd1
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 11 16:55:16 2022 -0600

    [man]: Fix link text formatting problem.
    
    * tmac/an-ext.tmac (UR, MT): Fix problem with incorrect line lengths and
      occasional "can't adjust" warnings when using hyperlinks.  Reduce the
      line length within the diversion by the amount of indentation used in
      the context.  Without this, lines were getting set too short.  (You
      might think they'd be too long, but when creating a new environment,
      the _formatter's_ default line length is used; that's 65n on terminal
      devices.)
---
 ChangeLog        | 10 ++++++++++
 tmac/an-ext.tmac | 20 ++++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b847dcf2..3403b74c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-11-11  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an-ext.tmac (UR, MT): Fix problem with incorrect line
+       lengths and occasional "can't adjust" warnings when using
+       hyperlinks.  Reduce the line length within the diversion by the
+       amount of indentation used in the context.  Without this, lines
+       were getting set too short.  (You might think they'd be too
+       long, but when creating a new environment, the _formatter's_
+       default line length is used; that's 65n on terminal devices.)
+
 2022-11-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man]: Add test to ensure that link text (when the hyperlink
diff --git a/tmac/an-ext.tmac b/tmac/an-ext.tmac
index e74bad8b5..acc219a1a 100644
--- a/tmac/an-ext.tmac
+++ b/tmac/an-ext.tmac
@@ -102,18 +102,20 @@
 .\" Start URL.
 .de UR
 .  ds m1 \\$1\"
-.  \" Save the line length, which may not be the default, so we can use
-.  \" it in the link text environment.  (groff's `evc` request copies
-.  \" too much, like the indentation amount.)
+.  \" Save the indentation and line length.  We want the diversion to
+.  \" format as if it has an indentation of zero (that comes for free
+.  \" when we switch environments), but we want the line length reduced
+.  \" by the amount of indentation that obtains when we output it.
 .  nr mK \\n(.l
+.  nr mI \\n(.i
 .  \" We can only hyperlink if we're not in a diversion.
 .  nr mD 0
 .  if '\\n(.z'' .nr mD 1
 .  if \\n(mD&\\nU&\\n(mU \{\
 .    \" Start diversion in a new environment.
 .    do ev link-text-env
-.    do ll \\n(mK
 .    do di link-text-div
+.    ll (\\n(mKu-\\n(mIu)
 .  \}
 .  rr mK
 ..
@@ -164,18 +166,20 @@
 .\" Start email address.
 .de MT
 .  ds m1 \\$1\"
-.  \" Save the line length, which may not be the default, so we can use
-.  \" it in the link text environment.  (groff's `evc` request copies
-.  \" too much, like the indentation amount.)
+.  \" Save the indentation and line length.  We want the diversion to
+.  \" format as if it has an indentation of zero (that comes for free
+.  \" when we switch environments), but we want the line length reduced
+.  \" by the amount of indentation that obtains when we output it.
 .  nr mK \\n(.l
+.  nr mI \\n(.i
 .  \" We can only hyperlink if we're not in a diversion.
 .  nr mD 0
 .  if '\\n(.z'' .nr mD 1
 .  if \\n(mD&\\nU&\\n(mU \{\
 .    \" Start diversion in a new environment.
 .    do ev link-text-env
-.    do ll \\n(mK
 .    do di link-text-div
+.    ll (\\n(mKu-\\n(mIu)
 .  \}
 .  rr mK
 ..



reply via email to

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