[TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Bug reports will be moved here when the described bug has been fixed

Moderators: Stefan2, Hacker, petermad

Post Reply
User avatar
white
Power Member
Power Member
Posts: 6940
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

[TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *white »

[Help - SHIFT+F4: New text file] wrote: Alternatively, the names can be passed in double quotes separated by spaces (or vertical lines).
Examples:
"file 1.txt" "file 2.txt" "file 3.txt"
"file 1.txt"|"file 2.txt"|"file 3.txt"
When using | characters you can use as many as you want. But not when use space as separator character.

Press Shift+F4
Try the following values and click OK

"|" as separator:

Code: Select all

"file 1.txt"|"file 2.txt"
Result: Works OK

Code: Select all

|"file 1.txt"|"file 2.txt"
Result: Works OK

Code: Select all

"file 1.txt"||"file 2.txt"
Result: Works OK

Code: Select all

|||"file 1.txt"|||"file 2.txt"|||
Result: Works OK


Space as separator:

Code: Select all

"file 1.txt" "file 2.txt"
Result: Works OK

Code: Select all

 "file 1.txt" "file 2.txt"
Result: "Cannot create file, change name" dialog

Code: Select all

"file 1.txt"  "file 2.txt"
Result: "Cannot create file, change name" dialog


Mixed space and "|":

Code: Select all

"file 1.txt"| "file 2.txt"
Result: Creates only "file 1.txt"

Code: Select all

 "file 1.txt"|"file 2.txt"
Result: Creates only "file 2.txt"

Code: Select all

"file 1.txt"                  ||  |      |"file 2.txt"
Result: Works OK
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53138
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *ghisler(Author) »

It's not defined what happens when you use multiple spaces, or a mix of spaces and vertical lines. The user will recognize their mistake when they do it.

Moderator message from: ghisler(Author) » 2026-04-23, 07:30 UTC

Moved to will not be changed
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6940
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *white »

HISTORY.TXT wrote: 27.04.26 Fixed: New text file (Shift+F4): Support a mix of names with and without double quotes, e.g. "name 1" name2 name3 "name 4" (32/64)
Tested OK using TC 11.57rc6 32-bit and 64-bit.
And when space is a separator, you can now use as many as you want.

Moderator message from: white » 2026-04-29, 23:27 UTC

Moved topic
» from TC Behaviour which will not be changed to TC Fixed bugs
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53138
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *ghisler(Author) »

Previously I was explicitly looking for quote space quote: " "
and replaced them with quote vertical_line quote: "|"
Now instead I check whether there is at least one double quote, and if yes, I replace all spaces which are NOT inside a double quote with vertical lines. Example:
"name 1" name2 name3 "name 4" -> "name 1"|name2||name3|"name 4"
Empty names are ignored.

What you can't use is a mix of spaces and vertical lines, e.g.
name1 | name2
Here TC will try to create name1 with a trailing space (which windows will not do) and name2 with a leading space (which works).
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6940
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *white »

ghisler(Author) wrote: 2026-04-30, 06:45 UTC Now instead I check whether there is at least one double quote, and if yes, I replace all spaces which are NOT inside a double quote with vertical lines. Example:
"name 1" name2 name3 "name 4" -> "name 1"|name2||name3|"name 4"
Empty names are ignored.
Except that trailing spaces at the end of the entire input string are removed, which creates inconsistencies.
These are considered equal (leading space in first line) :

Code: Select all

 "name"
|"name"
But these are not (trailing space in first line):

Code: Select all

"name" 
"name"|
In the latter example, the input with a trailing space gets the space removed, resulting in a single quoted filename. And a single quoted filename fails in this dialog (which is also counterintuitive for the user).

Another inconsistency is that trailing spaces do not get removed when using cm_Edit /GCN or cm_Edit /N. Example:

Code: Select all

cm_Edit /GCN=<"name" >
This is considered a list of filenames and works. But leave out the G and it doesn't work.



The treatment of separator spaces at the very beginning and at very end may not be intuitive for the user.
I think it is intuitive for the user that using a "|" is explicitly specifying a list of filenames. Example:

Code: Select all

|"name"
I think it is intuitive that this is interpreted as that the user explicitly specified a list of names (with one empty name).
But I think it is different when spaces are separators. Example (quoted name with leading and trailing spaces):

Code: Select all

    "name"   
Most people would probably see this as 1 filename and not as an explicitly specified list of filenames.


ghisler(Author) wrote: 2026-04-30, 06:45 UTC What you can't use is a mix of spaces and vertical lines, e.g.
name1 | name2
Here TC will try to create name1 with a trailing space (which windows will not do) and name2 with a leading space (which works).
I think this is not entirely correct. Trailing spaces are accepted, but not created as part of the filename when using the regular namespace. But trailing spaces are created in the filename when using the namespace \\?\ (for example, execute "cd \\?\d:\test\" first before trying to create the files).
(To delete filenames with trailing spaces, use the regular namespace)

But it is a bad example, because the thread is about when using quoted filenames. So the example should be:

Code: Select all

"name1" | "name2"
I think it is a matter of choice whether or not spaces should be interpreted as separators as well in this case. Currently that doesn't seem to be the case and the result is that the second name is (silently) not created. The first name is created and has a trailing space when working in the \\?\ namespace.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53138
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Shift+F4: When using quoted filenames, the behaviors of separators space and "|" are inconsistent

Post by *ghisler(Author) »

It would be a lot of work to handle all these special cases, that's why I moved the thread to "will not be changed" before.
Author of Total Commander
https://www.ghisler.com
Post Reply