gbranden pushed a commit to branch master
in repository groff.

commit 4136095bf3084e8b29274c6cfc4a02163a465f67
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Apr 3 14:54:54 2026 -0500

    src/roff/troff/input.cpp: Trivially refactor.
    
    * src/roff/troff/input.cpp (do_define_macro): Rename
      `reading_beginning_of_input_line` local to
      `can_terminate_definition_with_dot`.
    
      (transparent_throughput_file_request): Rename
      `reading_beginning_of_input_line` local to
      `is_at_beginning_of_input_line`.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 13 +++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2d0e77ba9..e9b5b7ae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-04-03  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp: Trivially refactor.
+       (do_define_macro): Rename `reading_beginning_of_input_line`
+       local to `can_terminate_definition_with_dot`.
+       (transparent_throughput_file_request): Rename
+       `reading_beginning_of_input_line` local to
+       `is_at_beginning_of_input_line`.
+
 2026-04-03  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (do_define_macro)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index ff8f799c7..bd39dcc20 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5518,7 +5518,7 @@ static void do_define_macro(define_mode mode, 
calling_mode calling,
     if (mm != 0 /* nullptr */ && (DEFINE_APPEND == mode))
       mac = *mm;
   }
-  bool reading_beginning_of_input_line = true;
+  bool can_terminate_definition_with_dot = true;
   if (COMP_DISABLE == comp)
     mac.append(PUSH_GROFF_MODE);
   else if (COMP_ENABLE == comp)
@@ -5532,7 +5532,7 @@ static void do_define_macro(define_mode mode, 
calling_mode calling,
        mac.append(static_cast<unsigned char>(c));
       c = read_char_in_copy_mode(&n, true /* is_defining */);
     }
-    if (reading_beginning_of_input_line && ('.' == c)) {
+    if (can_terminate_definition_with_dot && ('.' == c)) {
       const char *s = term.contents();
       int d = '\0';
       // see if it matches term
@@ -5610,7 +5610,7 @@ static void do_define_macro(define_mode mode, 
calling_mode calling,
        // TODO: grochar; may need NFD decomposition and UTF-8 encoding
        mac.append(static_cast<unsigned char>(c));
     }
-    reading_beginning_of_input_line = ('\n' == c);
+    can_terminate_definition_with_dot = ('\n' == c);
     c = read_char_in_copy_mode(&n, true /* is_defining */);
   }
 }
@@ -9595,7 +9595,7 @@ static void transparent_throughput_file_request()
       if (curdiv != topdiv)
        curdiv->copy_file(filename);
       else {
-       bool reading_beginning_of_input_line = true;
+       bool is_at_beginning_of_input_line = true;
        for (;;) {
          int c = getc(fp);
          if (EOF == c)
@@ -9605,10 +9605,11 @@ static void transparent_throughput_file_request()
                    " transparent file throughput; ignoring", int(c));
          else {
            curdiv->transparent_output(c);
-           reading_beginning_of_input_line = ('\n' == c);
+           is_at_beginning_of_input_line = ('\n' == c);
          }
        }
-       if (!reading_beginning_of_input_line)
+       // Add newline only if throughput file didn't end with one.
+       if (!is_at_beginning_of_input_line)
          curdiv->transparent_output('\n');
        fclose(fp);
       }

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

Reply via email to