groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/44: src/roff/troff/input.cpp (has_arg): Improve.


From: G. Branden Robinson
Subject: [groff] 03/44: src/roff/troff/input.cpp (has_arg): Improve.
Date: Tue, 3 Sep 2024 08:05:38 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit d36cf99d281a3cc966702bc6058aac46aa6add4b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 1 16:28:25 2024 -0500

    src/roff/troff/input.cpp (has_arg): Improve.
    
    * src/roff/troff/input.cpp (has_arg): Improve and slightly optimize;
      return `false` immediately if the current token is a newline.  This is
      more responsive when running interactively, particuarly with the new
      support for "peeking" ahead in the input stream by requests that read
      their arguments in copy mode (and in some other cases).
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 73100c5cb..0d37dcf2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-09-01  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (has_arg): Improve and slightly
+       optimize; return `false` immediately if the current token is a
+       newline.  This is more responsive when running interactively,
+       particuarly with the new support for "peeking" ahead in the
+       input stream by requests that read their arguments in copy mode
+       {and in some other cases}.
+
 2024-09-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index aeab5edfe..2828a178d 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1894,6 +1894,8 @@ void token::skip()
 // Specify `want_peek` if request reads the next argument in copy mode.
 bool has_arg(bool want_peek)
 {
+  if (tok.is_newline())
+    return false;
   if (want_peek) {
     int c;
     for (;;) {



reply via email to

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