Bug 479014 - Create New Text File adds invisible characters
Summary: Create New Text File adds invisible characters
Status: RESOLVED DUPLICATE of bug 297003
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 23.08.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-26 08:08 UTC by deadmeu
Modified: 2024-01-20 03:46 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description deadmeu 2023-12-26 08:08:05 UTC
SUMMARY
Creating a new text file creates a new file with 2 bytes of data. This is annoying as opening the file in KWrite afterwards means you need to delete these additional characters to have an empty file with no additional new lines or white space characters.

STEPS TO REPRODUCE
1. In a directory, open the context menu and select Create New > Text File
2. Select OK

OBSERVED RESULT
A new text file is created already containing data.

EXPECTED RESULT
A new empty file is created with the name provided by the user.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.11
Kernel Version: 6.6.8-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Akseli Lahtinen 2024-01-18 15:55:08 UTC
Can reproduce on Plasma 6 as well.
Comment 2 Jonathan Marten 2024-01-19 20:20:16 UTC
This appears to be intentional, so that the created file is detected as a text file MIME type and not as an empty file.  There is a separate option to create a truly empty file (0 bytes) if this is what is required.  See the duplicate bug.

*** This bug has been marked as a duplicate of bug 297003 ***
Comment 3 deadmeu 2024-01-20 03:46:37 UTC
(In reply to Jonathan Marten from comment #2)
> This appears to be intentional, so that the created file is detected as a
> text file MIME type and not as an empty file.  There is a separate option to
> create a truly empty file (0 bytes) if this is what is required.  See the
> duplicate bug.
> 
> *** This bug has been marked as a duplicate of bug 297003 ***

As a user, I would expect that "Create new text file" would just create an empty file with the ".txt" extension.

Having a white space character included on the first line is a bit annoying. It seems like KWrite automatically strips this character when you save the file, but if you were to open the file in Vim it would not be stripped automatically.

At most, I think maybe a newline character would make sense so that you automatically have the file ending in a newline character when you type something in on the first line directly after file creation, but that's all.