gbranden pushed a commit to branch master
in repository groff.
commit dfd0c79c34e50713677ce669634a84be2cd5fb04
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Mar 26 16:35:29 2025 -0500
[troff]: Fix potentially misleading diagnostics.
* src/roff/troff/input.cpp (token::description): When describing a
non-Basic Latin printable character in a diagnostic message (or
`pchar` output), remove Unicode-style annotation ("U+XXXX"). While
accurate if "latin1.tmac" is loaded, it can be incorrect if any of
"latin[259].tmac" or "koi8-r.tmac" is loaded.
---
ChangeLog | 9 +++++++++
src/roff/troff/input.cpp | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1199347ab..978f9161f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-03-26 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::description): Fix potentially
+ misleading diagnostics. When describing a non-Basic Latin
+ printable character in a diagnostic message (or `pchar` output),
+ remove Unicode-style annotation ("U+XXXX"). While accurate if
+ "latin1.tmac" is loaded, it can be incorrect if any of
+ "latin[259].tmac" or "koi8-r.tmac" is loaded.
+
2025-03-23 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (report_character_request): Make
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index edfde16ff..f5d60d8e3 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2689,8 +2689,10 @@ bool token::is_usable_as_delimiter(bool report_error)
const char *token::description()
{
// Reserve a buffer large enough to handle the two lengthiest cases.
- // "character code XXX (U+XXXX)"
+ // "character code XXX"
// "special character 'bracketrighttp'"
+ // Future:
+ // "character code XXX (U+XXXX)" or similar
const size_t maxstr = sizeof "special character 'bracketrighttp'";
const size_t bufsz = maxstr + 2; // for trailing '"' and null
static char buf[bufsz];
@@ -2710,7 +2712,7 @@ const char *token::description()
return buf;
}
else {
- (void) snprintf(buf, bufsz, "character code %d (U+%04X)", c, c);
+ (void) snprintf(buf, bufsz, "character code %d", c);
return buf;
}
case TOKEN_DUMMY:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit