gbranden pushed a commit to branch master
in repository groff.

commit 599374d9ab56d45bc5dd9f2aaea579e64768711a
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 8 09:55:43 2026 -0500

    [troff]: Refactor.
    
    Separate engine logic from input parsing logic with respect to an
    environment's "line tabs" enablement (a GNU troff feature altering how
    tab stop positions are computed).
    
    * src/roff/troff/env.h: Stop globally declaring `line_tabs_request()`.
    
      (class environment): Declare new member function returning `void`:
      `configure_line_tabs()`.  Drop declaration of `friend` function
      `line_tabs_request()`.
    
    * src/roff/troff/env.cpp (environment::configure_line_tabs): New
      function mutates object of `environment` class.
    
      (line_tabs_request): Replace manipulation of `environment` object's
      private member variable with call of the foregoing new public member
      function.
---
 ChangeLog              | 17 +++++++++++++++++
 src/roff/troff/env.cpp | 11 ++++++++---
 src/roff/troff/env.h   |  3 +--
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 04d5fefa9..c020631cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2026-04-08  G. Branden Robinson <[email protected]>
+
+       [troff]: Refactor.  Separate engine logic from input parsing
+       logic with respect to an environment's "line tabs" enablement (a
+       GNU troff feature altering how tab stop positions are computed).
+
+       * src/roff/troff/env.h: Stop globally declaring
+       `line_tabs_request()`.
+       (class environment): Declare new member function returning
+       `void`: `configure_line_tabs()`.  Drop declaration of `friend`
+       function `line_tabs_request()`.
+       * src/roff/troff/env.cpp (environment::configure_line_tabs): New
+       function mutates object of `environment` class.
+       (line_tabs_request): Replace manipulation of `environment`
+       object's private member variable with call of the foregoing new
+       public member function.
+
 2026-04-08  G. Branden Robinson <[email protected]>
 
        [groff]: Unit-test `linetabs` request.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index c7393d2a2..6eba8a54b 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1082,6 +1082,11 @@ void 
environment::set_supplemental_intersentence_space_size(int n)
   sentence_space_size = n;
 }
 
+void environment::configure_line_tabs(bool b)
+{
+  using_line_tabs = b;
+}
+
 hunits environment::get_input_line_position()
 {
   hunits n;
@@ -3139,13 +3144,13 @@ static void field_characters_request() // .fc
   skip_line();
 }
 
-void line_tabs_request()
+void line_tabs_request() // .linetabs
 {
   int n;
   if (has_arg() && read_integer(&n))
-    curenv->using_line_tabs = (n > 0);
+    curenv->configure_line_tabs(n > 0);
   else
-    curenv->using_line_tabs = true;
+    curenv->configure_line_tabs(true);
   skip_line();
 }
 
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index dcaad14a8..8b20c9f13 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -140,7 +140,6 @@ void line_width();
 void tabs_save();
 void tabs_restore();
 #endif
-void line_tabs_request();
 void title();
 #ifdef WIDOW_CONTROL
 void widow_control_request();
@@ -329,6 +328,7 @@ public:
   hunits get_input_line_position();
   const char *get_tabs();
   int is_using_line_tabs();
+  void configure_line_tabs(bool);
   unsigned get_hyphenation_mode();
   unsigned get_hyphenation_mode_default();
   int get_hyphen_line_max();
@@ -427,7 +427,6 @@ public:
   friend void tabs_save();
   friend void tabs_restore();
 #endif
-  friend void line_tabs_request();
   friend void title();
 #ifdef WIDOW_CONTROL
   friend void widow_control_request();

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

Reply via email to