Bug 427061 - External Tools Replace Current Document: Undo appends extra line
Summary: External Tools Replace Current Document: Undo appends extra line
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 20.08.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-28 07:00 UTC by Grósz Dániel
Modified: 2021-01-30 04:33 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 Grósz Dániel 2020-09-28 07:00:23 UTC
SUMMARY
If an external tool is set to replace the current document with the output of the command, an extra empty line is appended to the original document if you undo using the tool.

STEPS TO REPRODUCE
1. In Tools / External Tools / Configure, click Add / Add Tool...
2. Set Output to Replace Current Document.
3. Leave Reload Current Document unchecked. You may add %{Document:Text} as the input of the tool, or you may set Save to Current Document, and have the tool read the file by adding "%{Document:NativeFilePath}" as a parameter; it doesn't seem to matter. Complete the form to add the tool.
4. Invoke the external tool from the Tools / External Tools menu.
5. Undo.

OBSERVED RESULT
You get back the document as it was before invoking the tool, except with an extra empty line added at the end.

EXPECTED RESULT
You get back the document as it was.

SOFTWARE/OS VERSIONS
openSUSE Tumbleweed 20200925
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Comment 1 Dominik Haumann 2020-10-08 06:36:18 UTC
In the Open/Save config page in Kate's config dialog, do you have the "Append newline" at the end of the file if not present checked?
Comment 2 Grósz Dániel 2020-10-08 06:48:57 UTC
(In reply to Dominik Haumann from comment #1)
> In the Open/Save config page in Kate's config dialog, do you have the
> "Append newline" at the end of the file if not present checked?

I do, but the bug persists even if I uncheck it.

Also, the addition of the extra line doesn't get added to the undo stack. The extra line stays there even after further presses of Undo, even while edits made before running the external tool are getting undone.
Comment 3 Dominik Haumann 2020-12-31 16:24:22 UTC
I just tried again, and cannot reproduce, What do you have as Executable? I used `cat` to output the document contents from Disk via Argument "%{Document:NativeFilePath}". That works exactly as expected.
Comment 4 Bug Janitor Service 2021-01-15 04:33:45 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2021-01-30 04:33:21 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!