[TC 11.57] Handling of [X] placeholder when clipboard is empty

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

Moderators: petermad, Stefan2, white, Hacker

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

[TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

* In Windows settings, clear clipboard data (this is different from having an empty string on the clipboard)
* Press Shift+F4
* Enter:

Code: Select all

<abc[X]
Result: Preview shows "<Error!>"
Expected: Preview shows "abc", as when clipboard contains an empty string. Showing "<Error!>" suggests to the user that using [X] is not allowed.

Execute this command via a button:
cm_Edit /GCN="<abc[X]"
Result: New text file dialog is shown and the preview shows "<Error!>"

Execute this command via a button:
cm_Edit /N="<abc[X]"
Result: The editor is started with d:\somedir\<abc[X]
Expected: The editor is started with d:\somedir\abc

The multi-rename tool also shows an error for [X] when there is no clipboard data.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

This is intentional so people don't try to create files/folders when the clipboard contains unusable data (e.g. a bitmap), or no data.
You get an error in the multi-rename tool too in this case.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6888
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

ghisler(Author) wrote: 2026-05-08, 07:50 UTC This is intentional so people don't try to create files/folders when the clipboard contains unusable data (e.g. a bitmap), or no data.
Then why is an empty string on the clipboard allowed?
People may be clearing the clipboard by replacing it with an empty string (for example by using: cmd.exe /c clip>nul|clip). I think most people would consider no data and an empty string on the clipboard to be effectively the same. When pasting, it pastes nothing. Shouldn't they be treated the same way here, and preferably both allowed to paste nothing?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

Because an empty string is still a string, so there is no error accessing the clipboard.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6888
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

ghisler(Author) wrote: 2026-05-08, 13:03 UTC Because an empty string is still a string, so there is no error accessing the clipboard.
So it is intentional that people don't try to create files/folders when the clipboard contains no data, because there is an error accessing the clipboard? Why is that a concern for the user? And how is the user supposed to know this is the reason for the error? As I said: "I think most people would consider no data and an empty string on the clipboard to be effectively the same. When pasting, it pastes nothing."
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

Well, you would expect that people use this after copying something to the clipboard.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6888
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

ghisler(Author) wrote: 2026-05-08, 15:34 UTC Well, you would expect that people use this after copying something to the clipboard.
Not necessarily. A button using the placeholder could work with and without something on the clipboard. Similarly, a user could select a previously entered input from the most recently used list and expect it to work even when there is nothing on the clipboard. And some script may have cleared the clipboard, either by removing all data, or by putting an empty string on it.

You still haven't addressed that the error is confusing for the user. Even in the case when the clipboard has unintentionally no data, the error is confusing. And from the user's perspective there is no difference between no data and empty data.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

Sorry but I prefer to keep it this way. We would need a different parameter or some kind of modifier like [X0] or so to ignore an empty or wrong clipboard.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6888
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

ghisler(Author) wrote: 2026-05-10, 07:54 UTC Sorry but I prefer to keep it this way. We would need a different parameter or some kind of modifier like [X0] or so to ignore an empty or wrong clipboard.
I think the biggest issue right now is the inconsistency. From the user's perspective there is no difference between nothing on the clipboard and en empty string on the clipboard. And right now, you either give no protection against nothing on the clipboard (empty string on clipboard), or a false sense of security when nothing is on the clipboard (no data on clipboard). I suggest to at least make both cases work the same way.

And I prefer no error, because there is nothing wrong with nothing on the clipboard. No program, including Total Commander, gives an error when pasting and nothing is on the clipboard. If there is accidentally nothing on the clipboard, this could cause a problem for the user. But so could an accidentally wrong filename on the clipboard. In my view, there is no difference.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

I have already added [X0] now for the next version which will not return an error when the clipboard contains no string, but instead assume that the placeholder is empty.
Should [X] return an error when it contains an empty string?
Author of Total Commander
https://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7510
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *Horst.Epp »

ghisler(Author) wrote: 2026-05-12, 08:09 UTC I have already added [X0] now for the next version which will not return an error when the clipboard contains no string, but instead assume that the placeholder is empty.
Should [X] return an error when it contains an empty string?
No, there should be no error, just an empty string.
I don't see the need for the [X0] function in this case.
Windows 11 Home, Version 25H2 (OS Build 26200.8524)
TC 11.58 RC2 x64 / x86
Everything 1.5.0.1414b (x64), Everything Toolbar 2.3.0
QAP 12.3 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

2Horst.Epp
Sorry, I don't understand your comment.
No, there should be no error, just an empty string.
That's what [X0] is for: It will always insert a string, even if the clipboard is empty or contains something else like an image - then it will insert an empty string.
[X] will show an error when the clipboard is empty or contains something else. The question is whether [X] should also show an error i the clipboard DOES contain a string, but that string is empty (zero length).
Author of Total Commander
https://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7510
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *Horst.Epp »

ghisler(Author) wrote: 2026-05-12, 08:21 UTC 2Horst.Epp
Sorry, I don't understand your comment.
No, there should be no error, just an empty string.
That's what [X0] is for: It will always insert a string, even if the clipboard is empty or contains something else like an image - then it will insert an empty string.
[X] will show an error when the clipboard is empty or contains something else. The question is whether [X] should also show an error i the clipboard DOES contain a string, but that string is empty (zero length).
For me there is no need at all for [X0]
if [X] returns an empty string when nothing is in the clipboard.
No need for 2 functions.
Windows 11 Home, Version 25H2 (OS Build 26200.8524)
TC 11.58 RC2 x64 / x86
Everything 1.5.0.1414b (x64), Everything Toolbar 2.3.0
QAP 12.3 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 52921
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *ghisler(Author) »

Well, people's needs are different - personally I prefer to get an error when the clipboard is empty. That's why I introduced [X0] instead of changing [X], so people have a choice.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6888
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57] Handling of [X] placeholder when clipboard is empty

Post by *white »

Horst.Epp wrote: 2026-05-12, 08:25 UTC For me there is no need at all for [X0]
if [X] returns an empty string when nothing is in the clipboard.
No need for 2 functions.
Agreed. It's probably the implementation that creates the least astonishment. (See Principle of least astonishment in software design.)
ghisler(Author) wrote: 2026-05-12, 08:09 UTC I have already added [X0] now for the next version which will not return an error when the clipboard contains no string, but instead assume that the placeholder is empty.
Should [X] return an error when it contains an empty string?
Yes, definitely. That would create less astonishment.
Post Reply