Usage help text not properly aligned on multi-byte terminal

View: New views
2 Messages — Rating Filter:   Alert me  

Usage help text not properly aligned on multi-byte terminal

by Petr Pisar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

updating Czech translation of tar, I hit following problem: The
well-structured usage text printed on `tar --help' is not properly aligned
when running on multi-byte (UTF-8) terminal:

  -n, --seek                 v archivu se lze posunovat
      --no-check-device      při vytváření přírůstkových archivů se
                             nekontrolují čísla zařízení
      --occurrence[=ČÍSLO] zpracuje pouze ČÍSLO. výskyt každého souboru
                             z archivu; tento přepínač je platný jen ve
                             spojení s jedním z podpříkazů --delete,
                             --diff, --extract nebo --list a jen když je
                             zadán seznam souborů na příkazovém řádku
                             nebo přes přepínač -T; implicitní ČÍSLO je
                             1

Here you can that the first line of --occurrence option is shifted to left
because translated option argument `ČÍSLO' (NUMBER in English) contains
characters that have more bytes per character than one in UTF-8 locale.

This is caused by functions in lib/argp-fmtstream.c that operates on char type
which counts bytes (on my platform with my compiler) instead of wide
characters. Wrong count of spaces to fill is computed as consequence.

Also line wrapping suffers from similar problem. (Lines are wrapped sooner
than necessary.)

I verified this behaviour with tar-1.22 in LANG=cs_CZ.UTF-8 enviroment with
not yet published Czech translation (I will publish updated catalog as soon as
I get write access into tar domain in the Translation Project). I think this
bug can be demonstrated with any other language using characters from higher
Unicode planes in UTF-8 terminal.

-- Petr


attachment0 (197 bytes) Download Attachment

Re: Usage help text not properly aligned on multi-byte terminal

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Petr,

> updating Czech translation of tar, I hit following problem: The
> well-structured usage text printed on `tar --help' is not properly aligned
> when running on multi-byte (UTF-8) terminal:

Yes, indeed. I see the same effect in Polish translation. Thanks for
reporting, I'll fix that in argp module.

Regards,
Sergey