Improve File Name Display by Cutting Characters in the Middle

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
quik
Junior Member
Junior Member
Posts: 2
Joined: 2024-10-03, 09:47 UTC

Improve File Name Display by Cutting Characters in the Middle

Post by *quik »

Hello!

I would like to suggest an improvement for how Total Commander handles long file names. Currently, when a file name is too long to display fully, it gets cut off at the end. However, in many cases, the most important parts of a file name are both the beginning and the end. Wouldn't it be more useful to trim the middle part of the file name instead, while still showing the start and end?

For example:

Instead of:
VeryLongFileNameThatDoesntFitHere20241003.ext becoming VeryLongFileName....ext
It could become something like:
VeryLong...20241003.ext

This would be especially helpful when you have several files with the same name that differ only in their last characters. Identifying those files quickly would be much easier if both the beginning and end are visible.

I apologize if this has been suggested before. I used the search function of the forum but found nothing related.

Best regards,

quik

P.S. Thank you very much for this incredible piece of software. I've been using it for the last 25 years and can't live without it!
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *Fla$her »

Support. At least this can be done as an option.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *petermad »

2quik

How many of the end characters would you suggest that TC should show? 8, as in your excanple?
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1554
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *AntonyD »

It seems to me that a more correct answer would be - just insert an ellipsis in the middle of a long name.
That is, ALL possible characters should remain visible, and only approximately exactly in the middle of
a long text should a few characters disappear - to allow a simple ellipsis to be inserted there.

Code: Select all

So for a full name like:
ThisIsEndeedAVeryLoooooooooooooooooooooooongTitleYouEverSeenBeforeAndItDemonstratesADesirableApporach.txt
with next visual borders for rendering the text:
|                                                                                      |
a cut-off version of this file name Will become:
|ThisIsEndeedAVeryLoooooooooooooooooooooooong...AndItDemonstratesADesirableApporach.txt|
#146217 personal license
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *funkymonk »

Strong Support++

Fla$her wrote: 2024-10-03, 09:58 UTC Support. At least this can be done as an option.
If done as an option, how about an ini entry like

Code: Select all

alwaysShowLastChars=n
where a positive n is the number of chars to be shown at the end, and a negative value is treated as a percentage.
Default value: 0.

Examples:
n=8 would always show the last 8 chars
n=0 turns the option off (as it currently is)
n=-50 would split in the middle and show the last 50% (as exemplified by AntonyD)
quik
Junior Member
Junior Member
Posts: 2
Joined: 2024-10-03, 09:47 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *quik »

AntonyD wrote: 2024-10-03, 16:14 UTC It seems to me that a more correct answer would be - just insert an ellipsis in the middle of a long name.
That is, ALL possible characters should remain visible, and only approximately exactly in the middle of
a long text should a few characters disappear - to allow a simple ellipsis to be inserted there.
I think this one would be the correct way to do it.
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *petermad »

funkymonk wrote: 2024-10-03, 17:22 UTC If done as an option, how about an ini entry like

Code: Select all

alwaysShowLastChars=n
where a positive n is the number of chars to be shown at the end, and a negative value is treated as a percentage.
Default value: 0.
Support++
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *Fla$her »

funkymonk wrote: 2024-10-03, 17:22 UTC n=8 would always show the last 8 chars
n=0 turns the option off (as it currently is)
n=-50 would split in the middle and show the last 50% (as exemplified by AntonyD)
The idea of a percentage is somewhat dubious due to the limitation of the number of characters, which can be, for example, 2-3 in the name, and we can reduce the width of the panels as we like. It's clear that the percentage can be adjusted up or down, but I believe that the approximate middle in any case should be the lower limit, i.e. the second half should be the decreasing side.

When specifying a smaller number of characters from the end, for example 5, even when taking it as a rule to leave at least one character at the beginning, when reducing the width of the panel it may look like this:
  • Total Commander
    Total ..mander
    Total ..ander
    Total..ander
    Tota..ander

    Tot..ander
    To..ander
    T..ander
    T..nder
    T..der
    T..er

    T..r
    T..
    T.
    T
Obviously, 5 cannot be a constant number of characters from the end. Is it worth it?

If only the middle is used, however, it will look like this:
  • Total Commander
    Total ..mander
    Total ..ander
    Total..ander
    Total..nder
    Tota..nder
    Tota..der
    Tot..der
    Tot..er
    To..er
    To..r
    T..r

    T..
    T.
    T
In my opinion, this is the best option for comfortable work.

If too small or large a percentage is specified, for example, 1 or 99, then this would become useless in many cases.
But we can consider, for example, the following scheme:
0 — dots at position 8/8, i.e. at the end of the name (default)
1 — dots at position ~7/8
2 — dots at position ~6/8
3 — dots at position ~5/8
4 — dots at position ~4/8, i.e. about the middle
I think that would be more than enough.

And then the question arises, what to do with the extension in the case of this option? > cm_ConfTabChange > Show file extensions: ◉ aligned (with Tab)
It also reduced according to the same rules as the base name. Is it correct to use a common rule or should it not be applied to an extension?
Overquoting is evil! 👎
mrbeeye
Junior Member
Junior Member
Posts: 85
Joined: 2004-05-03, 02:56 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *mrbeeye »

Has been suggested (by me) almost 20 years ago: viewtopic.php?t=6173
User avatar
jbcb
Junior Member
Junior Member
Posts: 38
Joined: 2013-08-30, 06:43 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *jbcb »

Very good idea. I support it.

Removed characters could be selected in some clever way (not always according to the set mask). E.g. according to how similar file names differ from each other.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *funkymonk »

Fla$her wrote: 2024-10-04, 02:39 UTC The idea of a percentage is somewhat dubious due to the limitation of the number of characters, which can be, for example, 2-3 in the name, and we can reduce the width of the panels as we like. It's clear that the percentage can be adjusted up or down, but I believe that the approximate middle in any case should be the lower limit, i.e. the second half should be the decreasing side.
Well, I found AntonyD's suggestion (50%) reasonable and wanted to account for it. Personally, an adjustable integer number for the chars would be sufficient for me.
Fla$her wrote: 2024-10-04, 02:39 UTC When specifying a smaller number of characters from the end, for example 5, even when taking it as a rule to leave at least one character at the beginning, when reducing the width of the panel it may look like this:
Depending on the situation, it might be useful to see only the last chars. For me it is common to work with filenames like

AVeryLongFileNamePrefix00001
AVeryLongFileNamePrefix12922
AVeryLongFileNamePrefix22112
AVeryLongFileNamePrefix33112

Using alwaysShowLastChars=5 would at least show me the number at the end of the filename -- which is more important than the prefix in this example:

...00001
...12922
...22112
...33112

Of course, if there is not enough space to display the n chars and the ellipsis, then we are out of luck and more than n chars need to be removed. But that problem can only be solved by providing more space anyways.

Thus, one more idea:
The ellipsis "..." or ".." is probably the intuitive way to go. However, it eats up 2-3 chars (and there might even be filenames that indeed contain 2-3 dots in a row).
How about using a special char/indicator that (1) is visually striking, (2) cannot be used in filenames anyways, and (3) needs less space?
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *Fla$her »

jbcb wrote: 2024-10-04, 09:00 UTC E.g. according to how similar file names differ from each other.
Such an analysis will definitely slow down the output of the list.

funkymonk wrote: 2024-10-04, 09:47 UTCDepending on the situation, it might be useful to see only the last chars. For me it is common to work with filenames like

AVeryLongFileNamePrefix00001
AVeryLongFileNamePrefix12922
AVeryLongFileNamePrefix22112
AVeryLongFileNamePrefix33112
This is a special case and not to say that it's the most popular. For example, it could be useful for downloaded episodes via torrent. But in 85-90 percent of such files, the numbers are located, alas, not at the very end of the base name. Therefore, be that as it may, I would prefer the middle as a starting point. If there was some cm_ command with a parameter that could be used to toggle this view, then such flexibility would be more tangible.
funkymonk wrote: 2024-10-04, 09:47 UTCThe ellipsis "..." or ".." is probably the intuitive way to go. However, it eats up 2-3 chars (and there might even be filenames that indeed contain 2-3 dots in a row).
How about using a special char/indicator that (1) is visually striking, (2) cannot be used in filenames anyways, and (3) needs less space?
There is no ellipsis symbol. There are always two dots that can be paired with a dot in the name.
I don't think that one forbidden symbol instead of two dots will bring tangible benefits in terms of saving space. If we talk about the choice, then it could be *, ? or >, but I'm not sure that the others will approve of it, having been used to two dots for many years.

So what about the extension and the specified option? The file name can be as follows:
n.this_is_a_long_extension_don't_pay_attention_to_its_contents
Last edited by Fla$her on 2024-10-04, 13:39 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *funkymonk »

So, I guess with a simple "alwaysShowLastChars=n", where n can be a number or a percentage, we could cover 99% of all cases and needs...
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Improve File Name Display by Cutting Characters in the Middle

Post by *Fla$her »

2funkymonk
That doesn't answer my question.
Overquoting is evil! 👎
Post Reply