Reasoning behind TextFile.txt not being empty
Hi all,
when creating a new text file via KNewFileMenuPrivate
the created file is a copy of this file: https://invent.kde.org/frameworks/kio/-/blob/41463b985c7e553582d2b5c5b2f3a54c1a977a2b/src/new_file_templates/TextFile.txt
The copied file includes a
and a \n
.
In the past (21+ years ago) it seams that there was an issue with file icons not being displayed correctly: https://websvn.kde.org/?view=revision&revision=56790
However this does not seam to be the case anymore, both the "new file" and an empty file get the same icon assigned:
Is there still a reason behind this file not being empty?
If not I would like to propose to change the file to an empty one instead.
This would make working with files created with e.g. dolphin easier since the newly created file is ready to by edited without the need to press ctrl+a
and backspace
after the file is opened for the first time. This also leads to possible hard to find problems with scripts which use a shebang like in this case:
Or problems with scripting languages which have there own start markers like php. Running into such a situation is rather easy when pasting text from one file into another, since most text editors will set the cursor after the \n
content when the document is focused by clicking somewhere other then exactly the first line.
Beside the usability issue, I would just assume a new file to be empty and not to contain a rather arbitrary set of whitespace characters.
From what I can tell the reason for the initial introduction of the content seams not to be valid any more, the icons displayed in e.g. dolphin or kate are the same. So changing it would not add a regression. An open question would be if there are any tools out there which rely on this behavior (but I can't seam to find any).
Related:
- "KDE Neon > Dolphin > Create New > Text File: File not empty." https://forum.kde.org/viewtopic.php?f=224&t=142366
- "Newly created text files are not empty" https://bugs.kde.org/show_bug.cgi?id=297003
BR Mario