gbranden pushed a commit to branch master
in repository groff.

commit b472774c3c86ff45a284b103d2be1c47c217cda4
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Tue Apr 30 08:30:50 2024 -0500

    [troff]: Drop obscure info from `pev` req output.
    
    * src/roff/troff/env.cpp (environment::print_env): Stop reporting the
      value of the "discarding" flag as a property of the *roff environment.
      There's no corresponding concept in CSTR #54 or groff's documentation.
      It is an internal implementation detail having to do with the disposal
      of trailing spaces on input lines (and not even in general at that; as
      far as I can tell it applies only when the `\p` escape sequence is
      also used).  Move the report of its value from here...
    
      (environment::dump_troff_state): ...to here, a member function that is
      only reachable if the `DEBUGGING` preprocessor symbol is defined or if
      one is using a debugger on an unstripped troff executable.
---
 ChangeLog              | 15 +++++++++++++++
 src/roff/troff/env.cpp |  8 ++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c320d42f0..2f329fb7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-04-30  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/env.cpp (environment::print_env): Stop
+       reporting the value of the "discarding" flag as a property of
+       the *roff environment.  There's no corresponding concept in CSTR
+       #54 or groff's documentation.  It is an internal
+       implementation detail having to do with the disposal of trailing
+       spaces on input lines (and not even in general at that; as far
+       as I can tell it applies only when the `\p` escape sequence is
+       also used).  Move the report of its value from here...
+       (environment::dump_troff_state): ...to here, a member function
+       that is only reachable if the `DEBUGGING` preprocessor symbol is
+       defined or if one is using a debugger on an unstripped troff
+       executable.
+
 2024-04-30  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/env.cpp (environment::possibly_break_line):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index f36f9d6e1..6283cfc5e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2259,6 +2259,9 @@ void environment::possibly_break_line(bool 
must_break_here,
     else
       hyphen_line_count = 0;
     delete bp;
+    // Normally, the do_break() member function discards trailing spaces
+    // (cf. horizontal motions) from input lines.  But when `\p` is
+    // used, that mechanism is bypassed, so we do the equivalent here.
     space_total = 0;
     width_total = 0;
     node *first_non_discardable = 0 /* nullptr */;
@@ -2371,7 +2374,8 @@ node *environment::make_tag(const char *nm, int i)
 void environment::dump_troff_state()
 {
 #define SPACES "                                            "
-  fprintf(stderr, SPACES "register 'in' = %d\n", curenv->indent.to_units());
+  fprintf(stderr, SPACES "register 'in' = %d\n",
+         curenv->indent.to_units());
   if (curenv->have_temporary_indent)
     fprintf(stderr, SPACES "register 'ti' = %d\n",
            curenv->temporary_indent.to_units());
@@ -2384,6 +2388,7 @@ void environment::dump_troff_state()
          topdiv->get_page_offset().to_units());
   fprintf(stderr, SPACES "seen_break = %d\n", curenv->seen_break);
   fprintf(stderr, SPACES "seen_space = %d\n", curenv->seen_space);
+  fprintf(stderr, SPACES "discarding = %d\n", curenv->discarding);
   fflush(stderr);
 #undef SPACES
 }
@@ -3459,7 +3464,6 @@ void environment::print_env()
   errprint("  total number of spaces: %1\n", space_total);
   errprint("  input line start: %1u\n", input_line_start.to_units());
   errprint("  line tabs: %1\n", using_line_tabs ? "yes" : "no");
-  errprint("  discarding: %1\n", discarding ? "yes" : "no");
   errprint("  spread flag set: %1\n", spreading ? "yes" : "no"); // \p
   if (margin_character_node != 0 /* nullptr */) {
     errprint("  margin character flags: %1\n",

_______________________________________________
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to