Bug 454281

Summary: Adding custom shortcut deletes random lines in Shortcuts section in katerc
Product: [Applications] kate Reporter: Petros <psamaras1>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 22.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Petros 2022-05-23 15:50:31 UTC
SUMMARY
Note: It's a weird observation and I have not extensively tested, but judge for yourself :)

Initially, my custom shortcut for `kate_mdi_toolview_kate_plugin_katesearch` was lost after a new user session, or reboot.
I tried using the shortcuts manager profiles with no success, so I kept the Default Shortcuts profile, which included my custom shortcut.
Today the shortcut was lost (again) and I saved a katerc backup.
I created the *new* shortcut again (Ctrl+Shift+F) and compared kwinrc new and old. 
Old:
```
[Shortcut Schemes]
Current Scheme=Default

[Shortcuts]
kate_mdi_toolview_kate_plugin_symbolviewer=Ctrl+Alt+M
kate_mdi_toolview_kate_private_plugin_katefileselectorplugin=none
kate_mdi_toolview_kate_private_plugin_katefiletreeplugin=none
kate_mdi_toolview_kate_private_plugin_katekonsoleplugin=none
kate_mdi_toolview_kate_private_plugin_katesnippetsplugin=none
kate_mdi_toolview_kateproject=none
kate_mdi_toolview_kateprojectgit=none
kate_mdi_toolview_kateprojectinfo=none
kate_mdi_toolview_ktexteditorpreviewplugin=none
```
New:
```
[Shortcut Schemes]
Current Scheme=Default

[Shortcuts]
kate_mdi_toolview_kate_plugin_katesearch=Ctrl+Shift+F
kate_mdi_toolview_kate_private_plugin_katesnippetsplugin=none
kate_mdi_toolview_output=none
```

Of course, the shortcut works now. I have not logged out yet. I run to report ASAP :)

Possibly related bugs:
#453715 #438893 #428989

STEPS TO REPRODUCE
1. Save a copy of $XDG_CONFIG_HOME/katerc 
2. Set a custom shortcut for "View Search & Replace" plugin
3. Compare the changed katerc file with the saved copy

OBSERVED RESULT
Lines irrelevant to the shortcut that were included in `[Shortcuts]` Section, are deleted.
A line with the newly created shortcut is added.

EXPECTED RESULT
All lines that were included in `[Shortcuts]` Section, should be present (not deleted).
A line with the newly created shortcut is added.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.17.7-arch1-2 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i3 CPU 560 @ 3.33GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics

ADDITIONAL INFORMATION
I will add more info later, after some more searching.
Comment 1 Waqar Ahmed 2024-08-02 11:55:55 UTC
I dont think there is anything to do here. The lines can get deleted if the relevant toolview/plugin wasn't enabled. 

If you have a concrete issue or if the shortcut is erased in a reproducible way, please create a bug about that.