Author Topic: C::B loosing keyoard short cuts  (Read 3639 times)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
C::B loosing keyoard short cuts
« on: May 10, 2022, 11:54:20 am »
I am using the nightly builds under Linux GTK2, currently rev12535

As the title says C::B keeps forgetting my short cuts set in Settings->Editor->KeyboardShortcuts. As far as I can say it happens when C::B crashed and I re-start it.
I tried to set the config file ".config/codeblocks/default.cbKeyBinder20.conf" to read only this did not change it. The file still has my short cuts but still C:B starts without them.

Are the short cuts read on startip from somewhere else?

Maybe that is connected,  I can observe that also the order of the tabs in the management console are not saved. They always jump back to Projects|FSymbols|Symbols|Resources|Files. I have tried to use "SaveAll" and "Save workspace". I did not find out in which file this order is stored.








Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B loosing keyoard short cuts
« Reply #1 on: May 10, 2022, 05:52:26 pm »
Are you switching back and forth between different versions of CB?

If so, you need to use the '--personality=' parm so each does not overwrite the others key definition settings.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #2 on: May 10, 2022, 06:04:56 pm »
Are you switching back and forth between different versions of CB?
No, but I am running multiple Instances in parallel. They are all the same versions.


If so, you need to use the '--personality=' parm so each does not overwrite the others key definition settings.
I think you mean as startup parameter. Would that lead to multiple config versions? 

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B loosing keyoard short cuts
« Reply #3 on: May 10, 2022, 06:25:18 pm »
Using mulltiple CB's with the same default startup parameters means each starts up with --personality=default. Thus, when closing CB each will overwrite the others .conf file.

Try running the other CBs with a '--personality=<ChooseSomeUniqueName>' and see if it solves your problem.

The personality being used is shown at far right in the status bar.

Remember to allow CB to write to it's .conf files or it won't save your changes when you close a running CB.
« Last Edit: May 10, 2022, 06:32:22 pm by Pecan »

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #4 on: May 10, 2022, 06:37:52 pm »
Using mulltiple CB's with the same default startup parameters means each starts up with --personality=default. Thus, when closing CB each will overwrite the others .conf file.
Try running the other CBs with a '--personality=<ChooseSomeUniqueName>' and see if it solves your problem.
Currently all run with "default" indeed. Thanks for the suggestion, I will try that.

Remember to allow CB to write to it's .conf files or it won't save your changes when you close a running CB.
The idea was exactly that (I rarely change the config), but it seems for keyboard short cuts, the read only config file was also ignored for reading on startup. I did not expect that.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #5 on: May 10, 2022, 06:59:27 pm »
I tried to use it, but I'm afraid, it not very a practicable approach.
I started on the CLI with
Code
  codeblocks --personality=test1
It did not use the default configs but Factory reset configs. In the config folder using several personality would be a huge number of totally disjunct config files,  test1.xxxx, test2.xxxx, default.xxxxx. Before starting another new instance I would need to copy all relevant files to a new prefix and then start with that prefix.
If I would make an update to any of those configs there is no practical way to get that into all others.






Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: C::B loosing keyoard short cuts
« Reply #6 on: May 11, 2022, 08:35:04 am »
Could you not simply:
1) Start one CB instance
2) Fix your shortkeys
3) Save all, and close CB
4) Open as many instances you like
5) If you change some key bindings you have to do it in one single instance

I know this is somehow not "userfriendly" (and it bugs me a lot, because it happens to me every fu*** time) but i frankly do not know how other applications handle this (or how it should be handled). Here the last closed instance overwrites the previous settings and this is somehow logic....

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #7 on: May 11, 2022, 01:02:03 pm »
Could you not simply:
1) Start one CB instance
2) Fix your shortkeys
3) Save all, and close CB
4) Open as many instances you like
5) If you change some key bindings you have to do it in one single instance

I am not sure I can follow you. Obviously having 3 instances open, changing a shortkey in one and save and *then* close the others will overwrite the saved data. I think that is fine. But when I follow your procedure in step 4 all instances should open the same (updated) config file. All should have the new shortcut. Even when they all overwrite it the new shortcut should not be lost, should it?
And in practive, I can confirm this is working find 90% of the time. What troubles me is that after CB crashes I loose that abd I do not understand why. Thats what confuses me:
  • when my apps crash they ususally do not have time to save a config file. I would expect that when C::B reads its config file I close them afterwards, so they are not damaged on a crash. So I am not sure how a crash can loose shortcuts
  • I keep my shortcut config read only. Usually that works. Programs have the short cut. But after those crashes, they all loose it. How can that happen if the info is only stored in the keybinder file which is read only and where I verifiy that the setting is still there? So my guess is that the short cut is actually stored elsewhere. I did not find where, though.
  • There is a similar mystery with the F2 Tab "tabs". I always re-sort them. Every time. In every instance. Not each time, but very often the sort order is lost. I have not idea where this is saved.

I know this is somehow not "userfriendly" (and it bugs me a lot, because it happens to me every fu*** time) but i frankly do not know how other applications handle this (or how it should be handled). Here the last closed instance overwrites the previous settings and this is somehow logic....

I think there is an easy solution for this. At least it works fine in my own apps. This is how they work
  •   I have a menu entry "save config". It saves the config file(s) and nothing else. In CB the save concept is not fully clear to me. After a changeing a shortcut always I select "Save workspace" AND "Save all" beause I have no idea which one saves what.
  •   My options have a switch "Autosave Config on Close". When I de-select the option all config settings are read but never written unless I use "save config". That way any number of instances do always look and feel the same. And every time I change something config relevant, I save it.
    In one app I put it a step further where I have the options "Save to NAS", "Load from NAS". Those use a configured file path from a central storage and update the local configs  to and from the remote one. With this I can use the same config on any computer in the network but I also can work offline. Its easy to include a backup options and offer a "what did you change" line like a version control system.
  •   Actually I distinguish config files (with actual configuration data) and something I call a "Last Workspace"  file. Basically this is a config file but it only contains data to get the user to the point where he left off last time, e.g. dialog positions, last open file lists, last loaded files etc. This file is saved always and it matters very little when its lost or overwritten by another instance. It just opens the App as the last I had closed.

Maybe there is a flaw somewhere, but I did not come across it yet.



« Last Edit: May 11, 2022, 01:07:14 pm by tigerbeard »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B loosing keyoard short cuts
« Reply #8 on: May 11, 2022, 10:51:25 pm »
Questions: @ tigerbeard
1) Are all running CBs the same CB version ?
2) Do all your running CBs run the same plugins. ?
3) Is the menu system exactly the same on all running CB's ?

I too have experienced missing keys after a CB crash, but have never been able to figure out what's happening.

I also experience scrambled key defs after running the debugger with the same personality. But this I understand because the layout and menu for the debuggee CB is different from the debugger CB. In that case the debuggee's keys would overwrite the debugger keys.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #9 on: May 13, 2022, 01:04:13 pm »
1) Are all running CBs the same CB version ?
yes. There is only 1 installations
2) Do all your running CBs run the same plugins. ?
yes.
3) Is the menu system exactly the same on all running CB's ?
yes, I did not change the menu

I too have experienced missing keys after a CB crash, but have never been able to figure out what's happening.
Thanks for confirming. Are you aware of any shortcut key storage beside  "<CBconfig>/default.cbKeyBinder20.conf"?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B loosing keyoard short cuts
« Reply #10 on: May 13, 2022, 04:14:37 pm »
...snip...
Thanks for confirming. Are you aware of any shortcut key storage beside  "<CBconfig>/default.cbKeyBinder20.conf"?

<personality>.cbKeyBinder20.conf" is the only storage file unless you've setup a portable installation, in which case the  file is stored with the executable (I think).

When I get some time, I'll cause some crashes and see what happens.
 

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: C::B loosing keyoard short cuts
« Reply #11 on: May 13, 2022, 04:20:33 pm »
Quote from: tigerbeard
...snip...
Thanks for confirming. Are you aware of any shortcut key storage beside  "<CBconfig>/default.cbKeyBinder20.conf"?

<personality>.cbKeyBinder20.conf" is the only storage file unless you've setup a portable installation, in which case the  file is stored with the executable (I think).

When I get some time, I'll cause some crashes and see what happens.

Would you please zip up the keybinder.conf file and attach it for my testing.

Edit 2022/05/13
@tigerbeard
Could you suggest a sequence of actions to cause a crash that creates this situation. For example:
1) start this CB, then that CB etc.
2) Is the debugger running?
3) what is the debugger doing at crash time
Say whatever you think would help me recreate the situation.
Thanks
« Last Edit: May 13, 2022, 05:13:11 pm by Pecan »

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: C::B loosing keyoard short cuts
« Reply #12 on: May 14, 2022, 12:25:18 pm »
Current crashes are on a large project using multithreading. About 50% it crashes under gdb and 50% is crashes on some token issue on the tree (see ticket https://sourceforge.net/p/codeblocks/tickets/1152/. Despite the ticket status it still happens, although overall crashes improved a lot). I was not able to reproduce the gdb crashes with something smaller yet.

Here is a way to reproduce the tree failure. You might need 1-3 trials. I run it under Ubuntu 18.04
   https://forums.codeblocks.org/index.php/topic,24699.msg168507.html#msg168507

Attached is the keybinder file. It should be default with an added Alt-A shortcut to invoke AStyle.