Kate rearanges parts

I keep forgetting about this. Lately Kate does this weird thing. It keeps reverting text groups. As you can see in the screenie, the desktop actions were added last. They were UNDER the Desktop Entry part. Now, whenever I save the file and reopen it later, it’s “upsidedown” as it were. Happens with a lot of files.


Are you sure it is Kate doing this? Have you tried making a copy of the file somewhere where it will not be used and tested whether this happens?

I really have no idea what this is. Most part of these type of “multi text group” ( by lack of a better word, I copied from another partition are mixed up like this. It’s not that it’ll break things but it’s very very annoying. I’m checking a few. This one I made this morning. I can assure you it was done right. Boom. Mixed up. Wth ?!

I just found someone who experienced the very same. I’ll if I can find a solution.

https://www.reddit.com/r/kde/comments/tz05co/kate_text_editor_changes_text_in_files_to/

1 Like

The first reply tells you what is going on:

If it’s about .desktop files I am not sure however if I would look at the text editor for the problem. Desktop files can be created/modified from a lot of different programs which might rearrange the keys…have you tried with non-desktop files or witnessed the order change immediately before anything might have changed filetype associations, program descriptions or translations…

It’s not Kate changing these files.

The guy explains
it’s not just desktop files. In my case, as far as I can tell, it is. So, just for the sake of it, I quickly made another desktop file with actions and keep an eye on what’s triggering the arranging of the file.

Rename it to .txt instead of .desktop when testing. That way, you’ll be sure that it’s Kate that changes (which I really doubt is the case).

1 Like

I think I know what’s causing it. If I have a desktop file opened in Kate, I change the icon of the desktop application in Dolphin, turn back to Kate it reads something like “file has been changed…reload?” If hit reload, there’s a glitch and the file is rearranged. I would have to check ( create a couple to verify) but it happened on two desktop files when doing this procedure.

1 Like

In any case, it is not Kate doing it.

Yes, it’s a Kate issue. Only happens in Kate’s “reload”. Not sure if this has been filed as a bug.
Anywho. Here’s what happens.
I have the file open in Kate and rightclick the desktop file in Dolphin>select properties>change icon.
I turn the focus back to Kate which prompts that the file has been altered.
I click “reload”.
Bam, the text is garbled up.



There doesn’t seem to be some kind of “logic structure” in it either. In a file with several actions, the desktop entry part can end up between them.

:man_facepalming:

That literally tells you that Kate didn’t change it. The file was changed and Kate noticed it, prompting you to reload it.

1 Like

Yes, you’re right. It happens whenever you change a desktop file’s icon. Menueditor, prompt ( file properties)…doesn’t matter. The file WILL get garbled. I also checked when this started. I found that this already started on a kubuntu 21.10 ( which was plasma 5.22-ish?) since some of those garbled files I have dated from that release. You don’t even have to reload a file if a change was made, it just changes.

1 Like

@dzon, have you also tried modifying the .desktop file in KMenuEditor whilst viewing it in another text modifier with automatic poll+reload capabilities, like Download Visual Studio Code - Mac, Linux, Windows, rather than Kate, to isolate the issue to KMenuEditor? Currently, although improbable, because Kate is involved, the cause hasn’t yet been properly isolated.