[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 07/35: [troff]: Adjust line numbering in output warnings.
From: |
G. Branden Robinson |
Subject: |
[groff] 07/35: [troff]: Adjust line numbering in output warnings. |
Date: |
Tue, 10 Dec 2024 16:35:32 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 373836fafe31c2d94cb0c661a97f5131bab514b4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Dec 6 22:40:31 2024 -0600
[troff]: Adjust line numbering in output warnings.
* src/roff/troff/env.cpp (do_error): Fix off-by-one error in output
warnings in nroff mode. By convention, lines on terminals are
numbered starting at one; for example, using U.S. letter paper (with a
nominal type size of 10 points on 12 point spacing), the lines of the
11-inch page length are numbered 1-66, not 0-65.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 1 +
src/roff/troff/input.cpp | 8 ++++----
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 15bb3c6ff..31821d7db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,15 @@
Fixes <https://savannah.gnu.org/bugs/?66537> thanks to
Bjarni Ingi Gislason for the report and solution.
+2024-12-06 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/env.cpp (do_error): Fix off-by-one error in
+ output warnings in nroff mode. By convention, lines on
+ terminals are numbered starting at one; for example, using U.S.
+ letter paper (with a nominal type size of 10 points on 12 point
+ spacing), the lines of the 11-inch page length are numbered
+ 1-66, not 0-65.
+
2024-12-06 G. Branden Robinson <g.branden.robinson@gmail.com>
Stop pointlessly overwriting new CJK font descriptions for
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 1545cfa83..1f6ceae2a 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2192,6 +2192,7 @@ static void distribute_space(node *nd, int nspaces,
hunits desired_space,
bool force_reverse_node_list = false)
{
+ assert(desired_space >= H0);
if (desired_space.is_zero() || nspaces == 0)
return;
// Positive desired space is the typical case. Negative desired space
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 09d4dd6a7..d1cff0340 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -9732,13 +9732,13 @@ static void do_error(error_type type,
break;
case OUTPUT_WARNING:
if (in_nroff_mode) {
- int fromtop = topdiv->get_vertical_position().to_units()
- / vresolution;
+ int fromtop = (topdiv->get_vertical_position().to_units()
+ / vresolution) + 1;
fprintf(stderr, "warning [page %d, line %d",
topdiv->get_page_number(), fromtop);
if (topdiv != curdiv) {
- int fromdivtop = curdiv->get_vertical_position().to_units()
- / vresolution;
+ int fromdivtop = (curdiv->get_vertical_position().to_units()
+ / vresolution) + 1;
fprintf(stderr, ", diversion '%s', line %d",
curdiv->get_diversion_name(), fromdivtop);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 07/35: [troff]: Adjust line numbering in output warnings.,
G. Branden Robinson <=