If you have an .editorconfig file defining trim_trailing_whitespace = true Kate will also apply the rule for existing files, trimming all trailing whitespace found in the file. This is not in line with how it is implemented elsewhere: https://github.com/editorconfig/editorconfig/wiki/FAQ#my-files-are-not-automatically-reformatted-the-editorconfig-plugin-is-not-working > Existing files are not reformatted by the plugin (only newly input lines are formatted in the format given in the .editorconfig files) It's true that this is not defined as strictly in the property description, but it seems like a sane way to behave. https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#trim_trailing_whitespace
IIUC, it should trim spaces only on lines that are changed and not all lines?
(In reply to Waqar Ahmed from comment #1) > IIUC, > > it should trim spaces only on lines that are changed and not all lines? Examples of where I got bitten by this recently: https://gerrit.libreoffice.org/c/core/+/149627/1/oox/source/export/ooxml-export-notes.txt https://gerrit.libreoffice.org/c/dictionaries/+/150006/1/en/dialog/en_en_US.properties
ok but you didnt answer my question
(In reply to Waqar Ahmed from comment #3) > ok but you didnt answer my question If you meant to ask how the current behaviour should be changed in Kate, then the answer is yes, it should trim spaces only on lines that are changed.
I have no strong opinion on that. If other editors do that, we could relax the interpretation of this option, too.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/538
Git commit 94b328fc64e543d91930845d2a96ce08d3043295 by Christoph Cullmann. Committed on 10/04/2023 at 18:36. Pushed by cullmann into branch 'master'. change interpretation of trim_trailing_whitespace remove trailing spaces of modified lines M +1 -1 src/document/editorconfig.cpp https://invent.kde.org/frameworks/ktexteditor/commit/94b328fc64e543d91930845d2a96ce08d3043295