Fix example.
This commit is contained in:
parent
ca0f4b1dba
commit
5349fd7f49
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133566
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 3, 2002
|
||||
.Dd August 12, 2004
|
||||
.Dt WCWIDTH 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -65,15 +65,16 @@ int column, w;
|
||||
|
||||
column = 0;
|
||||
while ((ch = getwchar()) != WEOF) {
|
||||
if ((w = wcwidth(ch)) > 0)
|
||||
column += w;
|
||||
if (column >= 20) {
|
||||
w = wcwidth(ch);
|
||||
if (w > 0 && column + w >= 20) {
|
||||
putwchar(L'\en');
|
||||
column = 0;
|
||||
}
|
||||
putwchar(ch);
|
||||
if (ch == L'\en')
|
||||
column = 0;
|
||||
else if (w > 0)
|
||||
column += w;
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
|
Loading…
Reference in New Issue
Block a user