gbranden pushed a commit to branch master
in repository groff.
commit 45de311a7618edd04c6cbc8419ac9c28a469f6e7
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 22 01:32:04 2026 -0600
[grotty]: Revise drawing position diagnostics.
* src/devices/grotty/tty.cpp (tty_printer::add_char): Recast and
rearrange sanity-checking error diagnostics. Consistently place
quanization checks, which are fatal if they fail, first.
---
ChangeLog | 6 ++++++
src/devices/grotty/tty.cpp | 13 +++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5dcb29ab2..31ec07759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-11-22 G. Branden Robinson <[email protected]>
+
+ * src/devices/grotty/tty.cpp (tty_printer::add_char): Recast
+ and rearrange sanity-checking error diagnostics. Consistently
+ place quanization checks, which are fatal if they fail, first.
+
2026-11-22 G. Branden Robinson <[email protected]>
* src/devices/grotty/tty.cpp (tty_printer::add_char): Reënable
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index b0abf3245..915c983e7 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -401,8 +401,9 @@ void tty_printer::add_char(output_character c, int w,
color *fore, color *back,
unsigned char mode)
{
- if (h % font::hor != 0)
- fatal("horizontal position not a multiple of horizontal motion quantum");
+ if ((h % font::hor) != 0)
+ fatal("horizontal position is not a multiple"
+ "of horizontal motion quantum");
int hpos = h / font::hor;
// A negative horizontal drawing position is uncommon, but possible.
// "tmac/tests/e_line-numbering-works.sh" illustrates a case.
@@ -412,15 +413,15 @@ void tty_printer::add_char(output_character c, int w,
if (hpos > SHRT_MAX)
fatal("discarding character with huge horizontal position %1;"
" is terminal wider than %2 character cells?", h, SHRT_MAX);
- // The first output line corresponds to drawing position `font::vert`.
+ if ((v % font::vert) != 0)
+ fatal("vertical position is not a multiple"
+ " of vertical motion quantum");
int vpos = v / font::vert;
+ // The first output line corresponds to drawing position `font::vert`.
if (vpos <= 0) {
error("discarding output above first line of terminal");
return;
}
- if ((v % font::vert) != 0)
- fatal("vertical position not a multiple of vertical motion"
- " quantum");
if (vpos > nlines) {
tty_glyph **old_lines = lines;
// If we exceed the previous page length, double the size so that we
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit