Create file and open with Notepad++ fails

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

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

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

It should also be possible with this pathname: "C:\Program Files (x86)\Npp\notepad++.exe". Does it?
Yes it does, and also with environment variables like %commander_path% and similar.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1482
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

ghisler(Author) wrote: 2023-08-02, 13:58 UTC
It should also be possible with this pathname: "C:\Program Files (x86)\Npp\notepad++.exe". Does it?
Yes it does, and also with environment variables like %commander_path% and similar.
That's very good. And it's very good that this reaches Tc11 (at last moment).

Edit: 2ghisler(author)
Don't move this thread to "fixed bugs". You just - as you say - built a workaround around this bug in TC.
Last edited by JOUBE on 2023-08-02, 14:55 UTC, edited 3 times in total.
User avatar
white
Power Member
Power Member
Posts: 4626
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

JOUBE wrote: 2023-08-02, 13:48 UTC Incidentally, I simply installed the update that was automatically offered to me in notepad++ on that day mentioned. I use notepad++ every day. It was tow days after that post in that thread at notepad++.
See https://npp-user-manual.org/docs/upgrading/#no-new-version-found-safety-delay
JOUBE
Power Member
Power Member
Posts: 1482
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

Since you value an answer: I'm just a user of notepad++. The Tc should work with it and I am not interested in anything there (Docs, news forum) beyond notepad++. Unfortunately, the rather embarrassing thread - in which the Tc is mentioned - probably remains there somewhere.

The following remains:
SalmaTheBest wrote: 2023-08-01, 23:08 UTCThis problem exists in 10.52 which I was using till now, was hoping that v11 has this issue fixed.
JOUBE wrote: 2023-08-02, 09:28 UTCSo, to be clear, if Tc wants to speak with notepad++.exe, Tc has to handle it.
ghisler(Author) wrote: 2023-08-02, 11:27 UTC2white
I have added this fix to Total Commander 11 now.
Joube
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

Don't move this thread to "fixed bugs". You just - as you say - built a workaround around this bug in TC.
No, adding the dot is necessary because of notepad, too bad that notepad++ behaves differently...
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1482
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

ghisler(Author) wrote: 2023-08-02, 16:46 UTC
Don't move this thread to "fixed bugs". You just - as you say - built a workaround around this bug in TC.
No, adding the dot is necessary because of notepad, too bad that notepad++ behaves differently...
'Your' dot is intended to prevent the editors themselves from simply appending .txt. With these editors, a file without an extension is actually not possible/desirable. For me, on the other hand, notepad++ behaves correctly because it gives the user the freedom to create files without an extension. You have followed the user's wishes to create files without extensions with the other editors and have achieved this with the trick: dot. You have made that the default (even hardcoded), although these editors don't actually want it (they want to attach .txt instead). So this is of course not correct to overwrite this. The users have normaly actually to reconfigure this in that editors themselves.

Therefore, there is only one way to 'save' the matter. Installation of a switch in the ini with the default value '.'. Which you can then switch off. If you install this as a switch on the page with the editor in the configuration (with a dot/without a dot), you don't need to explain anything further, because using notepad++ will then immediately see what doesn't work with notepad++, based on the error message within notepad++ and the user know the config page where they can change it, because they have entered Notepad++ there thereself.

Joube
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6502
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Create file and open with Notepad++ fails

Post by *Horst.Epp »

2JOUBE
What's your problem now ?
The current solution works for any editor.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.77
QAP 11.6.3.3 x64
User avatar
white
Power Member
Power Member
Posts: 4626
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

JOUBE wrote: 2023-08-02, 19:20 UTC 'Your' dot is intended to prevent the editors themselves from simply appending .txt. With these editors, a file without an extension is actually not possible/desirable.
Sure it is. It's just that they utilize a default extension. That doesn't mean you can't use other extensions or no extension. By adding a dot at the end of a filename you are explicitly specifying the filename extension, namely an empty extension. This is a feature of the operating system and has been around since the MS-DOS era.
JOUBE wrote: 2023-08-02, 19:20 UTC For me, on the other hand, notepad++ behaves correctly because it gives the user the freedom to create files without an extension. You have followed the user's wishes to create files without extensions with the other editors and have achieved this with the trick: dot.
As explained, it is not really a trick but a feature of the operating system. Notepad++ handled that fine until a fix was created for an issue I reported that caused Notepad++ to crash. The crash occurred when there was an existing file with a filename that really ended with a dot and that was opened using the \\?\ namespace. The "\\?\" prefix causes the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. To prevent the crash an error is displayed when the passed filename ends with a dot. However this should only happen when the \\?\ namespace is used, so the fix was bad. A small change in the code has been made that should fix this, but a new version has not been released yet.

This isn't the only case where TC adds a dot to the filename and I agree with you that it would be best if the user has control over it. Here is a suggestion I made earlier:
white wrote: 2022-11-05, 13:08 UTC It would also be nice if, in addition to above, the user can control whether TC adds a dot to filenames without filename extension. TC is inconsistent in that it adds a dot when calling associated programs or external editor/viewer, but does not do so when a file is dragged and dropped on a button or when TC replaces special variables like %N used in button bar etc. A solution could be to allow another modifier in the command fields, similar to the modifiers * and **. Perhaps a more flexible syntax should be introduced. For example (?<modifiers>), similar to the inline regular expression modifiers which can enable or disable certain behaviors.
JOUBE
Power Member
Power Member
Posts: 1482
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

white wrote: 2023-08-02, 23:58 UTCand I agree with you that it would be best if the user has control over it.
Yes, hardcoded is never a good solution, also in this case. (e.g. if you rename - the stange filename - notepad++.exe to npp.exe ghisler(autor) 'fix' doesn't work). The user should - especially in the case of an interface to the outside - have the control.

Joube
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Create file and open with Notepad++ fails

Post by *AntonyD »

2ghisler(Author)
It's strange - but why not read the information about the file, where in the "OriginalFilename" field - there will definitely be
the required string `notepad++.exe`
And no any external renaming of the executable file name will confuse us here. And the fix will always work clearly.
#146217 personal license
User avatar
white
Power Member
Power Member
Posts: 4626
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

JOUBE wrote: 2023-08-03, 08:33 UTC Yes, hardcoded is never a good solution, also in this case. (e.g. if you rename - the stange filename - notepad++.exe to npp.exe ghisler(autor) 'fix' doesn't work).
Mr. Ghisler said in this thread:
ghisler(Author) wrote: 2023-08-02, 12:59 UTC Since it's a workaround, I wanted to make it as restrictive as possible.
So it's meant to be restrictive. It is a workaround as a service to the users.
JOUBE
Power Member
Power Member
Posts: 1482
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

white wrote: 2023-08-03, 08:44 UTC Mr. Ghisler said in this thread:
ghisler(Author) wrote: 2023-08-02, 12:59 UTC Since it's a workaround, I wanted to make it as restrictive as possible.
JOUBE wrote: 2023-08-02, 14:04 UTC Don't move this thread to "fixed bugs". You just - as you say - built a workaround around this bug in TC.

Moderator message from: white » 2023-08-03, 09:34 UTC

Fixed quotation.
User avatar
white
Power Member
Power Member
Posts: 4626
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

JOUBE wrote: 2023-08-03, 08:57 UTC
JOUBE wrote: 2023-08-02, 14:04 UTC Don't move this thread to "fixed bugs". You just - as you say - built a workaround around this bug in TC.
In this particular case, it is a workaround for a bug in Notepad++ that solves the problem described in the topic start. The general behavior of TC of adding a dot, is by design. If you have a suggestion to change this behavior, I suggest to post a suggestion in the Suggestions forum.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

I wouldn't call the behavior of notepad++ a bug, just an unexpected misbehavior. Windows does not allow dots at the end of names, although the underlying NTFS file system supports it. Using the prefix "\\?\" tells Windows to ignore its rules and just pass the name to the file system unchanged. But TC didn't pass the name with \\?\ prefix to notepad++, so it shouldn't ignore the Windows rules.
Author of Total Commander
https://www.ghisler.com
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3300
Joined: 2003-05-06, 11:46 UTC

Re: Create file and open fails

Post by *Sir_SiLvA »

JOUBE wrote: 2023-08-02, 05:06 UTC This is a Tc bug.
white wrote: 2023-08-03, 09:53 UTC In this particular case, it is a workaround for a bug in Notepad++ that solves the problem described in the topic start.
So it IS a np++ bug :twisted:
Hoecker sie sind raus!
Post Reply