[Aptitude-devel] Bug#360202: aptitude: misaligned output of aptitude show in ru_RU.UTF-8 locale

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Thu Jan 30 14:29:12 UTC 2014


Control: tags -1 + confirmed

The problem seems to be here:

src/cmdline/cmdline_show.cc:
    return cw::fragf("%s: %F",
                 title.c_str(),
                 indentbox(0, title.size()+2,
                           flowbox(cw::join_fragments(fragments, L", "))));

For indenting name and contents of a field (e.g. Depends) on several
lines, it uses zero as the first parameter meaning spaces of
indentation of the first line, and the second parameter for the spaces
of indentation of the remaining lines.

Since it takes "title.size() + 2", presumably because in ru_RU.UTF-8
locale each character takes two positions in a std::string (the type
of "title" variable), the lines following the first one are indented
with roughly double of the space needed.

This should be easy to fix if one knows how many characters will
occupy when printed.  But probably there should be a comprehensive
review of all this and use a solution everywhere in the code, not just
here.

Using std::wstring for all translatable strings might help, but I
don't know if it will work fine all the charsets.   Probably C++11 has
better support for this, so maybe this is the way to go.


Cheers.
-- 
Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>



More information about the Aptitude-devel mailing list