summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-02-17 20:37:08 +0000
committerwlemb <wlemb>2003-02-17 20:37:08 +0000
commitdd41e31bc5e4d53896180070a6dff88b0f4a06ad (patch)
tree425681d64830b6bad0d2055a5d911c13ec8266b5
parentcb5c9fa2e9b072eafd936a516564930a37270654 (diff)
downloadgroff-dd41e31bc5e4d53896180070a6dff88b0f4a06ad.tar.gz
Another round trying to really fix problems with `have_input'.
* src/roff/troff/input.cc (input_stack::get): Handle `have_input'. (token::next) <'\n'>, <\'\n'>: Don't handle `have_input'. * src/devices/grotty/tty.cc (tty_printer::put_color): Fix color handling if both foreground and background colors are default. * doc/groff.texinfo (Debugging): Document .lf differences to AT&T troff.
-rw-r--r--ChangeLog15
-rw-r--r--doc/groff.texinfo5
-rw-r--r--src/devices/grotty/tty.cc16
-rw-r--r--src/roff/troff/input.cc12
4 files changed, 35 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index ebbbc397..b90e7900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-02-17 Werner LEMBERG <wl@gnu.org>
+
+ Another round trying to really fix problems with `have_input'.
+
+ * src/roff/troff/input.cc (input_stack::get): Handle `have_input'.
+ (token::next) <'\n'>, <\'\n'>: Don't handle `have_input'.
+
+ * src/devices/grotty/tty.cc (tty_printer::put_color): Fix color
+ handling if both foreground and background colors are default.
+
+ * doc/groff.texinfo (Debugging): Document .lf differences to
+ AT&T troff.
+
2003-02-16 Werner LEMBERG <wl@gnu.org>
* src/devices/grotty/tty.cc (tty_printer::make_rgb_string): Avoid
@@ -123,7 +136,7 @@
* src/roff/troff/input.cc (do_name_test, do_expr_test,
do_zero_width): Push `\n' if closing delimiter is missing.
- (token::next) <ESCAPE_NEWLINE>, <'\n'>, <'\ '>: Reset `have_input'.
+ (token::next) <ESCAPE_NEWLINE>, <'\n'>, <\'\n'>: Reset `have_input'.
<'F'>: Make \F non-transparent at the beginning of line.
(process_input_stack) <token::TOKEN_CHAR, token::TOKEN_NEWLINE,
token::TOKEN_REQUEST, token::TOKEN_BEGIN_TRAP>: Don't handle
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 1d24e1c4..064016b8 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -12305,6 +12305,10 @@ Without argument, the request is ignored.
This is a debugging aid for documents which are split into many files,
then put together with @code{soelim} and other preprocessors. Usually,
it isn't invoked manually.
+
+Note that other @code{troff} implementations (including the original
+@acronym{AT&T} version) handle @code{lf} differently. For them,
+@var{line} changes the line number of the @emph{current} line.
@endDefreq
@DefreqList {tm, string}
@@ -12730,6 +12734,7 @@ Hallo!
\fB.xx\fP
@endExample
+@noindent
prints @samp{Hallo!} in bold face if in compatibility mode, and
@samp{.xx} in bold face otherwise.
diff --git a/src/devices/grotty/tty.cc b/src/devices/grotty/tty.cc
index 984ed6ca..bfb8a207 100644
--- a/src/devices/grotty/tty.cc
+++ b/src/devices/grotty/tty.cc
@@ -530,13 +530,15 @@ void tty_printer::put_color(char color_index, int back)
back = !back;
color_index = back ? curr_back_idx : curr_fore_idx;
}
- putstring(CSI);
- if (back)
- putchar('4');
- else
- putchar('3');
- putchar(color_index + '0');
- putchar('m');
+ if (color_index != DEFAULT_COLOR_IDX) {
+ putstring(CSI);
+ if (back)
+ putchar('4');
+ else
+ putchar('3');
+ putchar(color_index + '0');
+ putchar('m');
+ }
}
void tty_printer::end_page(int page_length)
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index 3ad7ac80..a40ede8c 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -107,8 +107,9 @@ int suppress_output_flag = 0;
int is_html = 0;
int begin_level = 0; // number of nested .begin requests
-int have_input = 0; // whether \f, \H, \R, \s, or \S has
- // been processed in token::next()
+int have_input = 0; // whether \f, \F, \D'F...', \H, \m, \M,
+ // \R, \s, or \S has been processed in
+ // token::next()
int tcommand_flag = 0;
int safer_flag = 1; // safer by default
@@ -437,7 +438,10 @@ inline int input_stack::get_level()
inline int input_stack::get(node **np)
{
- return (top->ptr < top->eptr) ? *top->ptr++ : finish_get(np);
+ int res = (top->ptr < top->eptr) ? *top->ptr++ : finish_get(np);
+ if (res == '\n')
+ have_input = 0;
+ return res;
}
int input_stack::finish_get(node **np)
@@ -1680,7 +1684,6 @@ void token::next()
return;
case '\n':
type = TOKEN_NEWLINE;
- have_input = 0;
return;
case '\001':
type = TOKEN_LEADER;
@@ -2045,7 +2048,6 @@ void token::next()
case '}':
goto ESCAPE_RIGHT_BRACE;
case '\n':
- have_input = 0;
break;
case '[':
if (!compatible_flag) {