summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-05-07 13:36:23 +0000
committerwlemb <wlemb>2001-05-07 13:36:23 +0000
commitb655be22360e0275e96d7307fc2b06c66ebbc6ee (patch)
treee919600932d6a29c9dd0750d4a9f8871fec444a2 /src
parent2cb0df330838a0f76209415679eae40517857968 (diff)
downloadgroff-b655be22360e0275e96d7307fc2b06c66ebbc6ee.tar.gz
The .ns and .rs requests are now honoured not only in the top-level
but in all diversions (similar to UNIX troff). This change is based on a patch from Tadziu Hoffmann <hoffmann@usm.uni-muenchen.de>. * src/roff/troff/div.h (diversion): Add `no_space_mode' member. (top_level_diversion): Remove `no_space_mode' member. * src/roff/troff/div.cc (diversion::diversion, top_level_diversion::top_level_diversion): Updated. (macro_diversion::output): Reset `no_space_mode'. (no_space, restore_spacing): Use `curdiv' unconditionally. (space_request, blank_line): Check `curdiv->no_space_mode'. (no_space_mode_reg::get_value, no_space_mode_reg::get_string): Use `curdiv' unconditionally. * NEWS, src/roff/troff/troff.man, man/groff.man, doc/groff.texinfo: Updated.
Diffstat (limited to 'src')
-rw-r--r--src/roff/troff/div.cc28
-rw-r--r--src/roff/troff/div.h2
-rw-r--r--src/roff/troff/troff.man2
3 files changed, 13 insertions, 19 deletions
diff --git a/src/roff/troff/div.cc b/src/roff/troff/div.cc
index a2e80d55..0ca45c32 100644
--- a/src/roff/troff/div.cc
+++ b/src/roff/troff/div.cc
@@ -49,7 +49,8 @@ static vunits truncated_space;
static vunits needed_space;
diversion::diversion(symbol s)
-: prev(0), nm(s), vertical_position(V0), high_water_mark(V0), marked_place(V0)
+: prev(0), nm(s), vertical_position(V0), high_water_mark(V0),
+ no_space_mode(0), marked_place(V0)
{
}
@@ -249,6 +250,7 @@ void macro_diversion::transparent_output(node *n)
void macro_diversion::output(node *nd, int retain_size,
vunits vs, vunits post_vs, hunits width)
{
+ no_space_mode = 0;
vertical_size v(vs, post_vs);
while (nd != 0) {
nd->set_vertical_size(&v);
@@ -316,7 +318,7 @@ top_level_diversion::top_level_diversion()
page_length(units_per_inch*11),
prev_page_offset(units_per_inch), page_offset(units_per_inch),
page_trap_list(0), have_next_page_number(0),
- ejecting_page(0), before_first_page(1), no_space_mode(0)
+ ejecting_page(0), before_first_page(1)
{
}
@@ -722,15 +724,13 @@ void begin_page()
void no_space()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 1;
+ curdiv->no_space_mode = 1;
skip_line();
}
void restore_spacing()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 0;
+ curdiv->no_space_mode = 0;
skip_line();
}
@@ -755,8 +755,8 @@ void space_request()
n = curenv->get_vertical_spacing();
while (!tok.newline() && !tok.eof())
tok.next();
- if (!unpostpone_traps())
- curdiv->space(n);
+ if (!unpostpone_traps() && !curdiv->no_space_mode)
+ curdiv->space(n);
else
// The line might have had line spacing that was truncated.
truncated_space += n;
@@ -767,7 +767,7 @@ void space_request()
void blank_line()
{
curenv->do_break();
- if (!trap_sprung_flag)
+ if (!trap_sprung_flag && !curdiv->no_space_mode)
curdiv->space(curenv->get_vertical_spacing());
else
truncated_space += curenv->get_vertical_spacing();
@@ -1122,19 +1122,13 @@ public:
int no_space_mode_reg::get_value(units *val)
{
- if (curdiv == topdiv)
- *val = topdiv->no_space_mode;
- else
- *val = 0;
+ *val = curdiv->no_space_mode;
return 1;
}
const char *no_space_mode_reg::get_string()
{
- if (curdiv == topdiv)
- return topdiv->no_space_mode ? "1" : "0";
- else
- return "0";
+ return curdiv->no_space_mode ? "1" : "0";
}
void init_div_requests()
diff --git a/src/roff/troff/div.h b/src/roff/troff/div.h
index 83f9e33c..3b726c37 100644
--- a/src/roff/troff/div.h
+++ b/src/roff/troff/div.h
@@ -33,6 +33,7 @@ protected:
vunits vertical_position;
vunits high_water_mark;
public:
+ int no_space_mode;
vunits marked_place;
diversion(symbol s = NULL_SYMBOL);
virtual ~diversion();
@@ -101,7 +102,6 @@ class top_level_diversion : public diversion {
int ejecting_page; // Is the current page being ejected?
public:
int before_first_page;
- int no_space_mode;
top_level_diversion();
void output(node *nd, int retain_size, vunits vs, vunits post_vs,
hunits width);
diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man
index 5f888866..a37d623f 100644
--- a/src/roff/troff/troff.man
+++ b/src/roff/troff/troff.man
@@ -1875,7 +1875,7 @@ register.
.TP
.B \en[.ns]
.B 1
-if no-space mode is active (if in top-level diversion),
+if no-space mode is active,
.B 0
otherwise.
.TP