#50 File name shortening

closed
nobody
None
5
2008-07-14
2007-10-05
MichalW
No

Pcmanfm would be almost godlike file manager if it have a option to shorten file name longer than two lines when displaying, so there would be no big gap between two rows of files when one have relly long name. Konqueror and windows explorer does it by default.

Discussion

  • PCMan
    PCMan
    2008-07-14

    • status: open --> closed
     
  • PCMan
    PCMan
    2008-07-14

    Logged In: YES
    user_id=1110932
    Originator: NO

    Neither GTK+ nor pango support this now.
    If they support it someday, I'll do it.

     
  • Logged In: NO

    You could simply cut the filename if it is longer than some definied value e.g 40 characters.

     
  • PCMan
    PCMan
    2008-07-14

    Logged In: YES
    user_id=1110932
    Originator: NO

    Neither GTK+ nor pango support this now.
    If they support it someday, I'll do it.

     
  • MichalW
    MichalW
    2008-07-14

    Logged In: YES
    user_id=1906675
    Originator: YES

    i do not know how your read filenames but i think you use function wich return char* if that so you could simple use strncpy to cut that string and feed gtk with this string in place of orginach string.

     
  • MichalW
    MichalW
    2008-07-14

    Logged In: YES
    user_id=1906675
    Originator: YES

    i do not know how your read filenames but i think you use function wich return char* if that so you could simple use strncpy to cut that string and feed gtk with this string in place of orginach string.

     
  • PCMan
    PCMan
    2008-07-14

    Logged In: YES
    user_id=1110932
    Originator: NO

    This never works. You have to consider i18n issues.
    Some languages use 3 - 6 bytes to represent one character.
    So, strncpy will break things in languages other than English.
    I know, glib provides utf-8 version of string routines.
    However, size of characters/words are quite different in different languages.
    For example, a Chinese character is two times wider than English ones.
    This is even more complicated with Arabic or some similar languages.
    If you have patch working correctly, I'll apply them, but strncpy is not acceptable.