Shift+F4 issue with new file name with spaces and no extension

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
limestone
Junior Member
Junior Member
Posts: 2
Joined: 2016-09-20, 13:30 UTC

Shift+F4 issue with new file name with spaces and no extension

Post by *limestone »

I routinely create text files with Shift+F4 (the editor I set in TC options is notepad2.exe), usually everything's ok. But if I specify a file name with spaces in it and without extension, the editor opens, but claims it cannot find a newly created file, yet the new file is there. Steps to reproduce:

* change default editor to other than notepad.exe (Windows notepad seems to be immune to this issue)
* navigate to any writable folder, Shift+F4, type any file name with space in it and no extension, e.g. "new file"
* press OK.

Expected result: file is created, editor opens a newly created blank file.

Actual result: file is created, editor fails to open the file (tried notepad2.exe, notepad++.exe, notepad2e.exe - all these fails).

Workaround: add a trailing . in a new file dialog, if a new file has to be sans extension, e.g. "new file."

Observation: The editor's error message has an extra quotes at the end of file path: "C:\Temp\new file"" not found.
Mind the quotes before C:\... and doubled quotes later, and this is not a bug of notepad2, since if I specify a known invalid file name from cmd line, I get the same error msg with proper quotes.

Win10Pro x64, TC9.51 x64.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *gdpr deleted 6 »

I cannot confirm with Notepad++ 7.9.1.
Tested with TC 9.51 x64 on Win 7 x64 Pro.
Other editors i have not tried.

As file names, i tested with "a b" and "1 2 3 4" (without the quotes), and Notepad++ opens the new blank file correctly without any problems.

How exactly have you specified the editor commandline in TC's configuration dialog? Just the path to the executable? Or some "additional flourish"?
If you used double-quotes for specifying the path to the editor executable, then try without. Even if the path to the editor executable contains white-spaces, don't double-quote it. See if this helps...

(Perhaps it might also be Windows 10 just being Windows 10. Who knows...)
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *Hacker »

limestone,
Try adding a space and

Code: Select all

"%1"
after the path to your editor's exe in TC's configuration.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *Stefan2 »

Hi limestone and welcome to the community.


Utilize Menu "Configuration > Options... > Edit/View"
Use the [>>] -button to select the editor for to see how TC adds quotes around the %1-placeholder.


I have no problems creating a new file named just 'new file' without extension
with my year-old "Edit/View"-setting [TOOLs\NotePad2\notepad2.exe "%1"]
((( "TOOLs" is a sub folder in my TC folder )))





 
HuSc
Junior Member
Junior Member
Posts: 25
Joined: 2014-03-10, 15:55 UTC

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *HuSc »

Hi,

I too get a strange effect if I try to create a new text file with a Space in its name and no file extension via Shift+F4 and using NP++.


My Test configuration: Win7-SP1 64bit German, TC 9.5.1 64bit, NP++ v7.8.9 32bit

First: Hacker's suggestion to add that "%1" solves the problem on my configuration. Thanks! :)

My workflow and the result:
- pressing Shift+F4 in the left panel
- I type an arbitrary file name according to limestone's scheme. (I tested various variants, with two or more words and got always the same message in NP++)
- NP++ starts and displays a warning dialog that I want to open many files (40140 files!) and if I were sure to do this.

---------------------------
Viele Dateien zu öffnen
---------------------------
40140 Dateien sollen in Notepad++ geöffnet werden.
Sind Sie sicher?
---------------------------
[Ja] [Nein]
---------------------------

That number is always 40140, regardless of the file's name.

When I confirm this dialog with "Nein" (= "No") then NP++ opens with a blank document and the file's name on the Tab. The new file exists now on the hard disk with 0 btyes. I can type text in NP++ and save that file, no problem. Only that NP++ warning is unusual and unexpected.

Though as I wrote above, Hacker's suggestion solves this problem on my configuration.

Regards
Hubert
User avatar
limestone
Junior Member
Junior Member
Posts: 2
Joined: 2016-09-20, 13:30 UTC

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *limestone »

Many thanks Hacker and Stefan2, the "%1" solves the issue. Previously the Configuration->Edit/View->Editor field had just plain "notepad2.exe" (no spaces around). My notepad2.exe is in c:\utils\, which is in system's %PATH%.

Upon further investigation, I checked the command line of invoked editor process with and without "%1" with Task Manager (Details tab->right click on column headers->"Select columns"->check "Command line"->OK). The option with "%1" silently adds the . after the file name and within quotes:

Code: Select all

notepad2.exe "c:\temp\new file."
The option without "%1" behaves unexpectedly - it adds the . after the quotes:

Code: Select all

notepad2.exe "c:\temp\new file".
The outcome depends on editor's ability to handle malformed command line (native notepad.exe happily ignores the . outside of quotes). The issue reproduced on Win7 x32 TC9.12 as well.

Anyways, "%1" helps, case is probably closed. Thanks again for comments ant suggestions!
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *MVV »

As I remember, similar bug was reported recently, it was also about unexpected dot position after closing double quote...

A-ha, here it is: viewtopic.php?f=32&t=72525
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50561
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Shift+F4 issue with new file name with spaces and no extension

Post by *ghisler(Author) »

Yes, it's a known bug which will be fixed in the next version, sorry.
Author of Total Commander
https://www.ghisler.com
Post Reply