For half and reverse line feeds, recognize both SUSv2-style escape-digit
and BSD-style escape-control-char sequences in the input stream. Submitted by: schwarze at OpenBSD Discussed with: schwarze at OpenBSD Obtained from: OpenBSD
This commit is contained in:
parent
234626f722
commit
7bc60a1616
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282722
@ -31,7 +31,7 @@
|
|||||||
.\" @(#)col.1 8.1 (Berkeley) 6/29/93
|
.\" @(#)col.1 8.1 (Berkeley) 6/29/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd August 4, 2004
|
.Dd May 10, 2015
|
||||||
.Dt COL 1
|
.Dt COL 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -82,18 +82,33 @@ recognized and interpreted by itself, which are listed below.
|
|||||||
Output multiple spaces instead of tabs.
|
Output multiple spaces instead of tabs.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The control sequences for carriage motion that
|
In the input stream,
|
||||||
.Nm
|
.Nm
|
||||||
understands and their decimal values are listed in the following
|
understands both the escape sequences of the form escape-digit
|
||||||
table:
|
mandated by
|
||||||
|
.St -susv2
|
||||||
|
and the traditional
|
||||||
|
.Bx
|
||||||
|
format escape-control-character.
|
||||||
|
The control sequences for carriage motion and their ASCII values
|
||||||
|
are as follows:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -width "carriage return" -compact
|
.Bl -tag -width "carriage return" -compact
|
||||||
|
.It ESC\-BELL
|
||||||
|
reverse line feed (escape then bell).
|
||||||
.It ESC\-7
|
.It ESC\-7
|
||||||
reverse line feed (escape then 7)
|
reverse line feed (escape then 7).
|
||||||
|
.It ESC\-BACKSPACE
|
||||||
|
half reverse line feed (escape then backspace).
|
||||||
.It ESC\-8
|
.It ESC\-8
|
||||||
half reverse line feed (escape then 8)
|
half reverse line feed (escape then 8).
|
||||||
|
.It ESC\-TAB
|
||||||
|
half forward line feed (escape than tab).
|
||||||
.It ESC\-9
|
.It ESC\-9
|
||||||
half forward line feed (escape then 9)
|
half forward line feed (escape then 9).
|
||||||
|
In
|
||||||
|
.Fl f
|
||||||
|
mode, this sequence may also occur in the output stream.
|
||||||
.It backspace
|
.It backspace
|
||||||
moves back one column (8); ignored in the first column
|
moves back one column (8); ignored in the first column
|
||||||
.It carriage return
|
.It carriage return
|
||||||
|
@ -205,12 +205,23 @@ main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
case ESC: /* just ignore EOF */
|
case ESC: /* just ignore EOF */
|
||||||
switch(getwchar()) {
|
switch(getwchar()) {
|
||||||
|
/*
|
||||||
|
* In the input stream, accept both the
|
||||||
|
* XPG5 sequences ESC-digit and the
|
||||||
|
* traditional BSD sequences ESC-ctrl.
|
||||||
|
*/
|
||||||
|
case '\007':
|
||||||
|
/* FALLTHROUGH */
|
||||||
case RLF:
|
case RLF:
|
||||||
addto_lineno(&cur_line, -2);
|
addto_lineno(&cur_line, -2);
|
||||||
break;
|
break;
|
||||||
|
case '\010':
|
||||||
|
/* FALLTHROUGH */
|
||||||
case RHLF:
|
case RHLF:
|
||||||
addto_lineno(&cur_line, -1);
|
addto_lineno(&cur_line, -1);
|
||||||
break;
|
break;
|
||||||
|
case '\011':
|
||||||
|
/* FALLTHROUGH */
|
||||||
case FHLF:
|
case FHLF:
|
||||||
addto_lineno(&cur_line, 1);
|
addto_lineno(&cur_line, 1);
|
||||||
if (cur_line > max_line)
|
if (cur_line > max_line)
|
||||||
|
Loading…
Reference in New Issue
Block a user