gbranden pushed a commit to branch master
in repository groff.
commit 12fa7fd6dff550d2a3fa25f9a55c7fd9ac389287
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Mar 28 04:48:59 2025 -0500
[troff]: Enrich "cannot adjust line" warning.
* src/roff/troff/env.cpp (environment::possibly_break_line): Supply more
information in "cannot adjust line" diagnostic; since we now have two
others of this form that warn when an output line (1) has no
adjustable spaces or (2) oversets, in this case disclose that it's (3)
underset, and say by how much.
---
ChangeLog | 8 ++++++++
src/roff/troff/env.cpp | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 425856899..ec672384e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,14 @@
other than POSIX Issue 8 conformance.
* configure.ac: Track rename.
+2025-03-28 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (environment::possibly_break_line):
+ Supply more information in "cannot adjust line" diagnostic;
+ since we now have two others of this form that warn when an
+ output line (1) has no adjustable spaces or (2) oversets, in
+ this case disclose that it's (3) underset, and say by how much.
+
2025-03-28 G. Branden Robinson <[email protected]>
* m4/groff.m4 (GROFF_PROG_TEST_SUPPORTS_EF_OPTION): Force
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index bcee757d0..760c0dda4 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2260,13 +2260,18 @@ void environment::possibly_break_line(bool
must_break_here,
bp->nd->split(bp->index, &pre, &post);
*ndp = post;
hunits extra_space_width = H0;
+ // TODO: We compute (target_text_length - bp->width) in several
+ // cases below. Consider computing it once, unconditionally, and
+ // giving it a name (`extra_space_width`? `desired_space`?).
switch (adjust_mode) {
case ADJUST_BOTH:
if (bp->nspaces != 0)
extra_space_width = target_text_length - bp->width;
else if (bp->width > 0 && target_text_length > 0
&& target_text_length > bp->width)
- output_warning(WARN_BREAK, "cannot adjust line");
+ output_warning(WARN_BREAK, "cannot adjust line; underset by %1"
+ " units",
+ hunits(target_text_length - bp->width).to_units());
break;
case ADJUST_CENTER:
saved_indent += (target_text_length - bp->width)/2;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit