The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

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

Moderators: Hacker, petermad, Stefan2, white

Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

Code: Select all

TOTALCMD#BAR#DATA
cm_Edit
/CGL0T="%P" /N="test.txt"
wcmicon2.dll,62



-1
If %P = "C:\Test\", the cursor sets to the new file, but if %P = "C:\te st\", it doesn't.
It's the same with a space in the file name.

The same thing happens with cm_EditNewFile 1.

GIF
Last edited by Fla$her on 2024-08-21, 12:07 UTC, edited 4 times in total.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16098
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *petermad »

Confirmed
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *ghisler(Author) »

Not confirmed. What does "C:\te st\" contain when you press the button? And where is the cursor?
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

ghisler(Author) wrote: 2024-08-18, 08:39 UTC What does "C:\te st\" contain when you press the button? And where is the cursor?
It's enough that it contains one file (preferably non-zero).
cm_Edit only works with files. Obviously, the cursor is on the file (preferably with a small text content).
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *ghisler(Author) »

Sorry, I cannot reproduce this problem. I only noticed that the parameter is ignored when adding the button via your TOTALCMD#BAR#DATA, but this happens because you didn't include all lines (the -1 at the end is important). After closing and re-opening TC, the button works fine here with paths both with and without spaces in the name. I will move this thread to "will not be changed" if you can't bring up another way to reproduce it.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

I only noticed that the parameter is ignored when adding the button via your TOTALCMD#BAR#DATA, but this happens because you didn't include all lines (the -1 at the end is important).
Are you sure? I have been using codes without specifying -1 for many years, and the parameters have never been ignored. This is the first time I've ever heard of such a thing.
After closing and re-opening TC, the button works fine here with paths both with and without spaces in the name.
I didn't even imagine that for such a trifle you need to reopen TC. As a last resort, I perform cm_ReloadBarIcons through hotkey, but I have never needed it for this either.
What do you mean by "fine"? Does the cursor move? Have you tested this on an x32 instance?

I added another command with a similar problem to the first post.
Last edited by Fla$her on 2024-08-20, 19:14 UTC, edited 1 time in total.
Overquoting is evil! 👎
sa16
Senior Member
Senior Member
Posts: 344
Joined: 2021-09-10, 07:15 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *sa16 »

2Fla$her
This is the first time I've ever heard of such a thing.
Apparently, this happens with an internal command, all parameters of which are specified in the "Parameters:" line.
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

2sa16
Nothing of the kind happens when you paste the code. Even if you select the command in the "Choose command" dialog, the parameters remain in place.

Do you have any thoughts on the topic of moving the cursor? Is the described confirmed or not?
Overquoting is evil! 👎
sa16
Senior Member
Senior Member
Posts: 344
Joined: 2021-09-10, 07:15 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *sa16 »

2Fla$her
Do you have any thoughts on the topic of moving the cursor?
If this is a bug, then where to see the rule, where should the cursor move?
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

If this is a bug, then where to see the rule, where should the cursor move?
And how can the presence or absence of a space change something in the author's potential idea?
In any case, this is not what I meant in the question. I ask about your thoughts on the problem of reproduction by the author. What could he be missing?
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *ghisler(Author) »

When you right click on the button and copy it, you get the following:
TOTALCMD#BAR#DATA
cm_Edit
/CGL0T="%P" /N="test.txt"
wcmicon2.dll,62



-1
Note the -1 at the end! This is the code of the command. Normally it would be the value 904 of cm_edit (which saves TC a lookup when you click on the button), but here you can't use the code because there are parameters to be taken into account.

Now when you paste the command without the -1, TC sees cm_Edit and converts it to 904 internally. Therefore the parameter is ignored when you click the button. After a restart, TC loads the button normally and sees that there are parameters.

You can call this a bug because TC doesn't check for parameters on paste, but that's just because it expects a button to be pasted after it was copied by the user, which would include the line -1. I will add this extra check also to the paste function for users who incorrectly share the copied button.


Anyway, this does not explain why Fla$her gets different results when a path contains spaces. I cannot reproduce this error. Maybe it's not about the spaces? With his option T="%P" he tells the function to look for the TEMPLATE file in the current directory. Since the file name is test.txt, it looks for the first file with extension .txt in that directory. But is there any such file?
Last edited by white on 2024-08-21, 08:45 UTC, edited 1 time in total.
Reason: Fixed missing "/" in closing quote tag
Author of Total Commander
https://www.ghisler.com
sa16
Senior Member
Senior Member
Posts: 344
Joined: 2021-09-10, 07:15 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *sa16 »

2ghisler(Author)
Anyway, this does not explain why Fla$her gets different results when a path contains spaces.
Fla$her sees a problem only in the fact that the cursor does not move to the created file.
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

ghisler(Author) wrote: 2024-08-21, 07:06 UTC Now when you paste the command without the -1, TC sees cm_Edit and converts it to 904 internally. Therefore the parameter is ignored when you click the button.
Do you want me to record a screencast that demonstrates that the button will work immediately without -1?
ghisler(Author) wrote: 2024-08-21, 07:06 UTC Maybe it's not about the spaces?
Have you tried the second command from the first post? Execute cm_EditNewFile 1 directly from the command line and set any nonexistent name with or without a space. In one case, the cursor remains in place, in the other it is moved to a new file. Do you deny it?
Overquoting is evil! 👎
User avatar
AntonyD
Power Member
Power Member
Posts: 1660
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *AntonyD »

2Fla$her
I think you should record both videos.
And especially try to reveal the essence of the bug in the second video.
Because I, for example, only get an error message that the file was not found. Some.
Therefore, it is not even immediately clear - what kind of cursor movement can we talk about at all.

P.S.
Execute cm_EditNewFile 1 directly from the command line and set any nonexistent name with or without a space.
as for me - in both cases cursor here DOES move on a new file record in the file panel ;)
#146217 personal license
Fla$her
Power Member
Power Member
Posts: 3015
Joined: 2020-01-18, 04:03 UTC

Re: The cursor doesn't move to a new file if there is a space in the path: cm_Edit + /CGL0T="%P" /N="FN"

Post by *Fla$her »

AntonyD wrote: 2024-08-21, 08:41 UTC Because I, for example, only get an error message that the file was not found.
See the tooltip in the example. It will help you understand why you have an error.
AntonyD wrote: 2024-08-21, 08:41 UTC as for me - in both cases cursor here DOES move on a new file record in the file panel ;)
TC x32 and/or x64?
Overquoting is evil! 👎
Post Reply