Menu

#1477 Layout of second project in a workspace seems to not be saved correctly.

Undefined
open
pecan
layout (2)
Bug_Report
2024-06-12
2024-05-23
I 473 17
No

Hello, I have noticed a layout related bug recently, can not remember since when exactly, I am sorry, here is the description.

Using Build 13518, currently on Fedora 40.

I have a workspace with project A and B, in the order as they appear in the list. Sometimes I have couple to few project B files open in the right side/split.
- Before, when I used "Save everything" option and closed Code:Blocks, the layout of both projects saved correctly and opened later as expected.
- Recently, I have noticed layout of project A files seem good, but project B is sometimes broken; some previously closed files open when I open the workspace, and also in the wrong, left, side/split.

I checked the project's layout file and noticed a bunch of open="1" on wrong files, so maybe some recent modification related to that!?
I have also made sure saving and restoring project and editor layouts are enabled in settings, turned them off and on again too.

Thank you! :)

Discussion

  • I 473 17

    I 473 17 - 2024-05-31

    Small update, I have noticed this even without any split layout, this seems to affect the opened files of the currently not active project, I have few files from project A open for example, but project B is currently active, and when I open Code::Blocks, some open files are closed, some closed files are open, the tab order is different.

    Another thing I remembered, I have recently started trying the Clangd_Client plugin, which I noticed only works on currently active project, not based on which project's tab is active like the Code completion plugin, may be side effect of the plugin, for a guess.

     
  • pecan

    pecan - 2024-06-01

    Can you give us an example of the steps that cause the problem so we can attempt to reproduce the problem on our own systems to debug it?

    Thanks for reporting.

     
  • I 473 17

    I 473 17 - 2024-06-03

    Hello, the issue took a bit for me to notice, but basic steps I think are: have more than one project in a workspace, one is active, then open, close or make changes to any files of a project that is not active, close the workspace, reopen and I think you will be able to find some layout data not being saved correctly. I have not done any statistically significant amount of testing to be sure it will happen however.

    I have tried to completely move the .layout files, and even .workspace files to be sure it is not just some issue with my project and workspace, and noticed the issue again.

    Hope I have translated the issue into words well, thank you! :)

     

    Last edit: I 473 17 2024-06-03
  • pecan

    pecan - 2024-06-04

    @I 473 17
    Thanks, I've managed to recreate the problem from your description. Since it happens with both clangd_client and legacy CodeCompletion, I don't think either is causing the problem.

    It appears that when files from multiple projects are open, then the wksp is closed, CB is assigning a layout "top" value in the layouts for all projects. When reloading the wksp, It then activates the "top" editor for the last project it loaded, not the actual active project.

    I've also experienced the weird situation that no top value was assigned to any project.layout in the wksp. That, however, seems to work correctly. Though I don't yet know why.

    I'll have a look at the CB core code to see why this is happening.

     
    ❤️
    1

    Last edit: pecan 2024-06-04
  • pecan

    pecan - 2024-06-04
    • assigned_to: pecan
     
  • pecan

    pecan - 2024-06-05

    I've gone all the way back to CB 10.03 and it works the same as the current description by 147317. So no commit has changed CB behavior in this regard.

    I have found that moving the desired active project to the bottom of the wksp (project context menu/project tree/move project up or down) performs the desired behavior (active editor in active project gets focused simply because the active project is at the bottom of the wksp tree).

    I cannot reproduce that a closed editor is reopened (as described by the original poster).

    I will experiment to see if there is a way to focus the specified top editor in the active project as opposed to the current behavior that the top editor of the last project in a wksp is focused.

     
  • pecan

    pecan - 2024-06-05

    @147327
    What have you got set in MainMenu/Settings/Environment/GeneralSettings/LayoutOptions?
    Especially in the area marked in yellow.

    I find that if I select both Save/restore/project layout and Save/restore/Editor layout, the described problems go away for me.

     

    Last edit: pecan 2024-06-05
  • I 473 17

    I 473 17 - 2024-06-11

    Hello, thank you very much for looking into it, my settings are exactly same as yours for the highlighted areas, and I have tried turning them off and on again too, some other things are different, but I rarely change the settings, at least, did not touch anything recently.

     
  • I 473 17

    I 473 17 - 2024-06-11

    Oh, I have noticed my changes to order of these tabs, or if I close some of them seems to not be saved, it just appears however the default is I suppose, just in case it could be related.
    I can notice this when I open Code::Blocks, no project, workspace loaded, but can not remember if this is a recent thing or it was always like this and I happened to notice now.

     

    Last edit: I 473 17 2024-06-11
    • I 473 17

      I 473 17 - 2024-06-11

      I got rid of my many years old default.conf file and let Code::Blocks generate a new one, manually copied over all the abbreviations, options, etc, I needed, and this particular problem was solved. So, likely not related to the main issue.

       
  • I 473 17

    I 473 17 - 2024-06-12

    Small update. Got rid of the projectname.layout file for the inactive project again, let Code::Blocks generate a new empty one. Inactive was first in the tree, active was second/last, as you mentioned that may work better.

    In the inactive project, had 5 tabs open, everything worked fine, closed 1 at some point, Code::Blocks saved that 4 should be open, good, but all have open="1" in the projectname.layout file, two have same tab position tabpos="3", every time I close and then open the workspace, 4 seemingly random tabs of the 5 would open...

    Next I will let Code::Blocks generate a new layout file again, switch back to old code completion plugin, and see if the issue persists and report back after a bit. I do not mean to disregard what you mentioned about there seemingly being no changes to relevant things from a while (10.3), and the issue being not related to the new plugin, however I have never seen this issue before recently in many years of using Code::Blocks (started long after 10.3), and I do not use most of the fancy plugins, or change most or often any settings after initial setup, so just want to be sure.

     
  • pecan

    pecan - 2024-06-12

    Thanks for doing all this testing.
    I'm at a loss though, since I can't seem to recreate the problem.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.