[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: wc --max-line-length vs. TABs [Re: Bug in wc
From: |
Bo Borgerson |
Subject: |
Re: RFC: wc --max-line-length vs. TABs [Re: Bug in wc |
Date: |
Fri, 22 Aug 2008 16:27:22 -0400 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080724) |
Jim Meyering wrote:
>
> I'm tempted to make the change, but it seems too drastic, after 11 years.
> Do any of you rely on the current TAB-counting behavior of GNU wc?
>
Hi,
It looks like TAB characters aren't alone in being counted by printed
width rather than count:
$ echo '好' | wc -L
2
Does it make sense to change the behavior for TAB, but not for "wide"
characters?
Bo
diff --git a/src/wc.c b/src/wc.c
index 0bb1929..b3f1ab2 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -378,7 +378,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
{
int width = wcwidth (wide_char);
if (width > 0)
- linepos += width;
+ linepos ++;
if (iswspace (wide_char))
goto mb_word_separator;
in_word = true;