Update file type on save only if path changes
ClosedPublic

Authored by mperttunen on Jan 18 2017, 3:53 PM.

Details

Summary

Currently in the event that a file has variables set by the file type default settings and has variables set by a .kateconfig file, on initial file opening the variables from the .kateconfig file take precedence. However, when saving the file, variables are updated using the file type settings but the .kateconfig file is not reread, causing variables to change to their file type settings values.

Update the logic such that the file type settings are only reloaded when the file name changes, as is currently done for .kateconfig reading, to ensure that .kateconfig always takes precedence.

Test Plan

For example, set "indent-width 8" in kate settings for Sources/C and create a directory with a .kateconfig file containing "kate: indent-width 4" and a file test.c. Open the file with Kate and modify it and save it. Before the patch on opening the indent width will be set to 4 and after saving it will be 8. After the patch the indent width will stay as 4 even after saving.

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mperttunen updated this revision to Diff 10324.Jan 18 2017, 3:53 PM
mperttunen retitled this revision from to Update file type on save only if path changes.
mperttunen updated this object.
mperttunen edited the test plan for this revision. (Show Details)
mperttunen added a reviewer: KTextEditor.
mperttunen set the repository for this revision to R39 KTextEditor.
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 18 2017, 3:53 PM
Restricted Application added subscribers: Frameworks, kwrite-devel. · View Herald Transcript

I am not sure if "path" is enough here, but also the filename is important.
Could we not guard it with "filename changed" instead for local files?

Good point, I missed that. I'll post a new revision once I have the chance.

mperttunen updated this revision to Diff 10504.Jan 24 2017, 5:33 PM
mperttunen removed R39 KTextEditor as the repository for this revision.

Fixed issue pointed out by cullmann

cullmann accepted this revision.Feb 13 2017, 12:30 PM
cullmann added a reviewer: cullmann.

Yes, looks better that way.

This revision is now accepted and ready to land.Feb 13 2017, 12:30 PM

If you have no commit rights, pass me your mail address for the commit, will do that for you.

Thanks, I don't think I do. My mail address is 'cyndis@kapsi.fi'.

This revision was automatically updated to reflect the committed changes.