Bug 487768 - New blank text files from Dolphin or Desktop dialog include a seemingly unnecessary space character.
Summary: New blank text files from Dolphin or Desktop dialog include a seemingly unnec...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.92.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-29 21:59 UTC by ocalhoun
Modified: 2024-06-30 16:50 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ocalhoun 2024-05-29 21:59:46 UTC
SUMMARY
When a new text file is created through Dolphin or any system dialog, the text file created is not completely empty -- it contains a space and a newline.

I presume the purpose of this is to make the thumbnail preview images look better, as the thumbnail of a completely empty text file does look different. However, the space is unnecessary for this. A text file containing a space and a newline is completely indistinguishable from a text file containing only a newline, when looking at the thumbnail preview.

Meanwhile, the space at the beginning of the document can be annoying sometimes. If you open the text file in Kate and forget to delete that space first, Kate will assume the leading space indicates indentation and it will indent every subsequent line the same way, adding an unnecessary leading space to every line. (This is particularly annoying when using this workflow to create a phyton script, where indentation matters.)

The text file is created using the template here:
https://invent.kde.org/frameworks/kio/-/blob/master/src/new_file_templates/TextFile.txt?ref_type=heads
This is a very minor issue, yes, but all that would be required to fix it is to remove the space character in that file.

STEPS TO REPRODUCE
1. Open Dolphin to a directory with write access
2. Right click --> create new --> text document
3. Open the text document

OBSERVED RESULT
The text document contains an unnecessary space character. (That character can be removed without affecting the thumbnail preview of the file, as long as the following newline is retained.)

EXPECTED RESULT
The text document contains only a newline. (So it won't cause unnecessary indentation confusion in any text editor, and so that the newly created blank text document is truly blank.)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu Studio 22.04 |6.5.0-25-lowlatency
(available in About System)
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Comment 1 Bug Janitor Service 2024-06-30 15:51:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1652
Comment 2 Nate Graham 2024-06-30 16:50:13 UTC
Git commit 3b5a569733511ba6d4fe3896d9891390e928d535 by Nate Graham.
Committed on 30/06/2024 at 15:50.
Pushed by ngraham into branch 'master'.

Remove unnecessary space character in empty text file template
FIXED-IN: 6.4

M  +0    -1    src/new_file_templates/TextFile.txt

https://invent.kde.org/frameworks/kio/-/commit/3b5a569733511ba6d4fe3896d9891390e928d535