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;
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils