From daa790840cd5a25a45eecf88c2cab70bbfc04feb Mon Sep 17 00:00:00 2001 From: Tom Rhodes Date: Tue, 17 Aug 2004 04:45:52 +0000 Subject: [PATCH] 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 Submitted by: Marc Silver Approved by: re (scottl) --- lib/libc/locale/wcwidth.3 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libc/locale/wcwidth.3 b/lib/libc/locale/wcwidth.3 index 06c0067c3146..c87c7ed3adf7 100644 --- a/lib/libc/locale/wcwidth.3 +++ b/lib/libc/locale/wcwidth.3 @@ -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')