[TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

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

Moderators: petermad, Stefan2, Hacker

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

[TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »


Execute:

Code: Select all

cm_Edit /CL0N="<[C]"
Result is OK. Dialog shows:
<[C]
Error "<path lenght = 0>"

Execute:

Code: Select all

cm_Edit /GCL0N="<[C]"
Result is not OK. There is an error beep and dialog is shown with:
<C>
(no error)

Execute:

Code: Select all

cm_Edit /N="<[C]"
Result is not OK. Editor is started with filename "<C>"




Execute:

Code: Select all

cm_Edit /CL0N=<<1-2>["-"C]>
Result is OK. Dialog shows:
<1-2>["-"C]
Error "<path lenght = 0>"

Execute:

Code: Select all

cm_Edit /GCL0N=<<1-2>["-"C]>
Result is not consistent. The file "-2" is created.

Execute:

Code: Select all

cm_Edit /N=<<1-2>["-"C]>
Result is not consistent. Editor is started with filename "-2"

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

Currently no error or empty string warning is shown because neither of these examples create an error or empty string. They create a string like <C> which is only evaluated completely when actually creating the files. I will try to create the name of the first file and check whether that is empty or invalid too.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

17.05.26 Fixed: Show error "Path length = 0!" when counter passed to cm_Edit produces empty name, e.g. cm_Edit /GN="<[C]" (32/64)
Tested using TC 11.57a pre3.

All cases tested OK, except:

Code: Select all

cm_Edit /N=<<1-2>["-"C]>
The new text file dialog is show instead of the error message.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

The dialog doesn't show "create file x", it shows "Enter name of file to edit". It's one of the two branches of the cm_Edit function:
- one is to strictly open a single existing file with an editor. This is the "F4" branch.
- the other is to create a single file, or to open or create multiple files. Only that branch has access to the dialog with edit box. This is the Shift+F4 branch. Since the F4 branch can only handle single files, just opening multiple files also needs to be handled by the Shift+F4 branch.

So when you get an error in the first branch, you will only get an error message. In the second branch, you will get the edit dialog.

In the above case, when you change the text in the dialog to e.g. <1-2>["-"C]a
then the two files "a" and "-2a" will be opened, but not created.

Although it is a bit confusing for the user, I want to keep it this way.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

ghisler(Author) wrote: 2026-05-19, 06:49 UTC The dialog doesn't show "create file x", it shows "Enter name of file to edit". It's one of the two branches of the cm_Edit function:
- one is to strictly open a single existing file with an editor. This is the "F4" branch.
- the other is to create a single file, or to open or create multiple files. Only that branch has access to the dialog with edit box. This is the Shift+F4 branch. Since the F4 branch can only handle single files, just opening multiple files also needs to be handled by the Shift+F4 branch.
The dialog's primary purpose is to create a new file and edit it. When you press F1 in the dialog, you get the page "SHIFT+F4: New text file".

The user used to only be able to create and edit a single file using the dialog. This later expanded to also being able to create multiple files, and to be able to not launch the editor.

The dialog is opened by cm_EditNewFile, generally not by cm_Edit (which purpose was to act like pressing F4 and opening the file under the cursor). The dialog is only opened by cm_Edit when using the /C switch to create files. AFAIK, it was never possible to get this dialog to specify a filename for editing without creating a file.

You are suggesting we now have a new dialog besides the "SHIFT+F4: New text file" dialog. A dialog that is indistinguishable from the "SHIFT+F4: New text file" dialog. A dialog that also has context sensitive help "SHIFT+F4: New text file". A dialog that can only be opened by using cm_Edit /N="<1-2>[C][error]" (making an error in a range specification). A dialog that creates a file when a single file is specified, and opens files without creating files if multiple filenames are specified. It doesn't make sense.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

I'm aware of that, but it would require a huge amount of code changes to get all the different error dialogs there. So unfortunately you will have to live with this slight inconvenience, sorry.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

ghisler(Author) wrote: 2026-05-19, 16:10 UTC I'm aware of that, but it would require a huge amount of code changes to get all the different error dialogs there.
Are there more dialogs than the "Invalid filename specified" and the "Path length = 0!" error? Both of them are simple standard Windows dialogs.
ghisler(Author) wrote: 2026-05-19, 16:10 UTC So unfortunately you will have to live with this slight inconvenience, sorry.
Not only me, but all users who encounter this. And they will have no clue about what is happening, because it is not in any way understandable for the user.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

Are there more dialogs than the "Invalid filename specified" and the "Path length = 0!" error? Both of them are simple standard Windows dialogs.
There is also the Exif error. But the problem isn't showing the dialogs, it's determining the exact cause in the same way as the edit dialog. I will add something, but you will certainly find 100 cases where the two differ.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

Please check with Total Commander 11.57a RC1!
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

HISTORY.TXT wrote: 19.05.26 Fixed: cm_Edit/cm_MkDir with parameters: Show error message instead of edit name dialog when there is an error in the name string while not creating files (32/64)
19.05.26 Fixed: cm_Edit/cm_MkDir with parameters: Show error when the N parameter contains a range but no counter, e.g. N="<1-2>[N]" (32/64)
Copy and paste error in above lines? "cm_Edit/cm_MkDir" must be "cm_Edit"?

Other than that, tested OK using TC 11.57a rc1 32-bit and 64-bit.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

Thanks for confirming the fix! I have updated the online version of history.txt, please check.
https://www.ghisler.com/history1157a.txt
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

You changed only the first line?
I think the second line was also only for cm_Edit.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

I have tried with 11.57, and indeed

Code: Select all

cm_mkdir /N="<1-2>[N]"
already shows an error there. Therefore I have also changed the second line now.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6941
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *white »

ghisler(Author) wrote: 2026-05-22, 07:12 UTC Therefore I have also changed the second line now.
Confirmed.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57a pre2] cm_Edit template with conditional counter resulting in empty string

Post by *ghisler(Author) »

Great!

Moderator message from: ghisler(Author) » 2026-05-24, 07:20 UTC

Moved to fixed bugs
Author of Total Commander
https://www.ghisler.com
Post Reply