[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 03/06: [grotty]: Slightly refactor.
From: |
G. Branden Robinson |
Subject: |
[groff] 03/06: [grotty]: Slightly refactor. |
Date: |
Wed, 6 Oct 2021 16:19:15 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit a8109f737376629d2030ecd2787bdae9a46be7e4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Oct 6 18:58:57 2021 +1100
[grotty]: Slightly refactor.
* src/devices/grotty/tty.cpp (tty_printer::special_link): Use consistent
loop styles and drop unnecessary arithmetic.
Also get garbage space out of a code comment.
---
ChangeLog | 7 +++++++
src/devices/grotty/tty.cpp | 7 ++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f2e184b..86e457a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2021-10-06 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [grotty]: Slightly refactor.
+
+ * src/devices/grotty/tty.cpp (tty_printer::special_link): Use
+ consistent loop styles and drop unnecessary arithmetic.
+
+2021-10-06 G. Branden Robinson <g.branden.robinson@gmail.com>
+
[man]: Fix oversight and improve `MR` test.
* tmac/an-ext.tmac (initialization): Enable `mY` register to
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 3995917..a71217e 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -461,7 +461,7 @@ void tty_printer::special(char *arg, const environment
*env, char type)
// Produce an OSC 8 hyperlink. Given ditroff input of the form:
// x X tty: link [URI[ KEY=VALUE] ...]
-// produce "OSC 8 [;KEY=VALUE];[URI] ST ". KEY/VALUE pairs can be
+// produce "OSC 8 [;KEY=VALUE];[URI] ST". KEY/VALUE pairs can be
// repeated arbitrarily and are separated by colons. Omission of the
// URI ends the hyperlink that was begun by specifying it. See
// <https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda>.
@@ -498,10 +498,11 @@ void tty_printer::special_link(const char *arg, const
environment *env)
arg--;
// The first argument is the URI.
char *uri = (char *)arg;
- while (c != '\0' && c != ' ' && c != '\t')
+ do
c = *arg++;
- ptrdiff_t uri_len = arg - uri - 1;
+ while (c != '\0' && c != ' ' && c != '\t');
arg--;
+ ptrdiff_t uri_len = arg - uri;
// Any remaining arguments are "key=value" pairs.
char *pair = 0;
bool done = false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 03/06: [grotty]: Slightly refactor.,
G. Branden Robinson <=