Fix incorrect code in an example. The previous example would produce

19 column positions wide in the first line and 20 in the rest of the lines.
This fixes the example to provide the correct output.

PR:		53454
Noticed by:	Kuang-che Wu <kcwu@kcwu.homeip.net>
Submitted by:	Marc Silver <marcs@draenor.org>
Approved by:	re (scottl)
This commit is contained in:
Tom Rhodes 2004-08-17 04:45:52 +00:00
parent 2cfe973b62
commit daa790840c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133914

View file

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 12, 2004
.Dd August 17, 2004
.Dt WCWIDTH 3
.Os
.Sh NAME
@ -65,10 +65,16 @@ int column, w;
column = 0;
while ((ch = getwchar()) != WEOF) {
<<<<<<< wcwidth.3
if ((w = wcwidth(ch)) > 0)
column += w;
if (column > 20) {
=======
w = wcwidth(ch);
if (w > 0 && column + w >= 20) {
>>>>>>> 1.4
putwchar(L'\en');
column = 0;
column = w;
}
putwchar(ch);
if (ch == L'\en')