Bug 490637 - Kate displays newline at the end of file when there isn't
Summary: Kate displays newline at the end of file when there isn't
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 24.05.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-22 07:23 UTC by phoenix
Modified: 2024-07-22 07:28 UTC (History)
0 users

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 phoenix 2024-07-22 07:23:20 UTC
SUMMARY

Kate displays a newline at the end of a file, even when there isn't one there. This is annoying when editing a yaml file where the linter expects you to have a newline at the end of the file. In kate the editor shows a newline at the end of the file, but the file contents don't have this newline.

The annoying part is that even when adding a newline within kate, kate won't save it. So there is no way to make the yaml linter happy.

The Setting "Append newline at end of file on save" In "Open/Save" does not seem to have an effect.

STEPS TO REPRODUCE

1. Create new file with the following contents:

```yaml
---

key: "value"
```

2. Save the file
3. Kate will add a newline (Line 4) in the display
4. Check the file with any other editor, e.g. `vim`. The immaginary newline is not there
5. `yamllint` will complain about the missing newline

OBSERVED RESULT

* Newline is displayed but not saved
* Enabling/Disabling the "Append newline at end of file on save" does not seem to have any effect on this issue

EXPECTED RESULT

* Newline is only displayed if present
* If present, the newline character at the end of the file will be saved to disk

SOFTWARE/OS VERSIONS

openSUSE Tumbleweed 20240716
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION

None
Comment 1 phoenix 2024-07-22 07:28:30 UTC
Sorry, this report was wrong. The "Append newline at end of file on save" does indeed work, the issue was on the side of a git hook that messed up the file before committing.

Please ignore, Kate behaves just fine :-)