Disable pre-creation of empty files for editor

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
browny
Senior Member
Senior Member
Posts: 288
Joined: 2007-09-10, 13:19 UTC

Disable pre-creation of empty files for editor

Post by *browny »

When using Shift+F4 with a new file name, TC first creates an empty file because otherwise some editors might fail with "file not found" error.
This has unpleasant side effects.
The first is that quitting editor without saving still leaves an empty file.
Second is discussed in this topic: Use UTF-8 with byte-order mark when creating a new .txt file - file encoding might be treated differently for new and already existing files, but the idea of forcing file contents and encoding is simply bad.

Maybe an option could be added, so that creation of empty file would be avoided?
There is a space in Options dialog around editor name, but this setting is not too obvious and might be restricted to .ini file only.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6496
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Disable pre-creation of empty files for editor

Post by *Horst.Epp »

browny wrote: 2024-02-07, 14:43 UTC Maybe an option could be added, so that creation of empty file would be avoided?
This would not allow creating .txt files formatted as UTF-8 with BOM as a default.
There is a need for the template file to copy over into the new file.
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.73
QAP 11.6.3.2 x64
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Disable pre-creation of empty files for editor

Post by *tuska »

2browny

When I press Shift+F4, NO file is created immediately by default.
A window appears with this text: "Enter file name to edit:"
Only after you have entered a name and confirmed with "OK" is the file created and opened in the editor.

If you are referring to cm_Edit, redefined to Shift+F4, e.g.
cm_Edit /CGL1 /T="C:\totalcmd\Templates" /N="_.txt"
then the parameter /G ... G: Go, create new files immediately (has no effect when not using C)
ensures that the file is created immediately.

If you omit the parameter /G, the window appears with the text: "Enter file name to edit:"
Only after you have entered a name and confirmed with "OK" is the file created and opened in the editor.


TC 11.03RC4 x64/x86 | Use UTF-8 with byte-order mark when creating a new .txt file (Sample solution)
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Disable pre-creation of empty files for editor

Post by *white »

tuska wrote: 2024-02-07, 20:13 UTC Only after you have entered a name and confirmed with "OK" is the file created and opened in the editor.
It seems clear to me that the OP wants an option so the filename is passed to the editor without creating the file first.

Personally, I like that an empty file remains when you exit the editor. And it doesn't seem like a big deal to need to delete it if it is not wanted. Having said that, perhaps a good way to implement such feature is to implement it using the template feature. A special template filename or special content in a template file could signal to TC to not create the file beforehand.
browny
Senior Member
Senior Member
Posts: 288
Joined: 2007-09-10, 13:19 UTC

Re: Disable pre-creation of empty files for editor

Post by *browny »

white wrote: 2024-02-08, 00:57 UTC It seems clear
It seems clear because you do actually read, unlike those who use tunnel vision.
Nowhere UFT-8 or templates were specified in the opening message.

Editor will create new files with the configured encoding; otherwise do not use the suggested option.
tuska wrote: 2024-02-07, 20:13 UTC Only after you have entered a name and confirmed with "OK" is the file created and opened in the editor.
Incorrect. File needs to be created only if it did not exist.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Disable pre-creation of empty files for editor

Post by *tuska »

browny wrote: 2024-02-08, 08:47 UTC
tuska wrote: 2024-02-07, 20:13 UTC Only after you have entered a name and confirmed with "OK" is the file created and opened in the editor.
Incorrect. File needs to be created only if it did not exist.
I can only counter with this statement:
If I want to open an existing file, I don't need Shift+F4,
because then I would open this file with a double or single click.

Due to your statements, I unfortunately have a problem understanding this topic.
I am therefore withdrawing from this topic.
Post Reply