Bug 337891

Summary: Synchronise editor windows between Code and Debug modes
Product: [Applications] kdevelop Reporter: Manu <turkeyman>
Component: UI: tabbed pagesAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: adymo, aleixpol, dhaumann, kde.kfoar, kde, kfunk, mykola.chornyi.email, pbandaru
Priority: HI    
Version: 5.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Manu 2014-07-30 03:22:00 UTC
The biggest thing about kdevelop which constantly drives me away to other editors, is the fact that there is no options to synchronise the editor windows between code and debug modes.

Please add an option that:
When switching between code and debug modes, the open tabs and the active tab/code window remain visible, and in the same place.

It's really annoying that I am looking at my code, and every time I begin or stop debugging, the code I'm looking at just goes away.

I understand this is by design, but consider an option to maintain synchronisation between modes, it will make a lot of incoming users a lot more comfortable.
Comment 1 Kevin Funk 2014-07-30 08:31:05 UTC
+1. I also find that highly annoying. We need to fix that behavior.
Comment 2 Kevin Funk 2015-03-18 12:50:12 UTC
*** Bug 345308 has been marked as a duplicate of this bug. ***
Comment 3 Priyanka Bandaru 2016-04-07 03:30:03 UTC
Hi Kevin,

I am working on this bug.I just wanted to know which file i should open to correct the bug.
Comment 4 Kevin Funk 2016-04-07 21:55:28 UTC
Hi Priyanka, you'll find the area switching logic in kdevplatform:./sublime. Unfortunately the code is not easy to follow I'm afraid, lots of abstractions involved here.

@apol, @adymo: Maybe you can give a hand?
Comment 5 Alexander Dymo 2016-04-07 22:29:19 UTC
This can be done only as a hack. The whole architecture is built with an assumption that different areas will have different set of editor and tool views.

The place to hack it is probably MainWindow::setArea in sublime/mainwindow.cpp. You'll have both old and new area objects. Then you'll need to:
- remove all "views" (not the "toolviews") from the new area (in case there are views there from previous switch)
- traverse all views in the old area and ask their documents to add views to the new area (make sure to do this in a tree-like fashion to preserve split window configuration, Area::walkViews is the way to do this)

I think I'd do this after line #121 HoldUpdates hu(this);

This hack is not too bad for production use. View creation is super fast. And this won't actually create any KTextEditor::View instances until they need to be displayed on the screen.
Comment 6 Priyanka Bandaru 2016-04-09 18:40:52 UTC
Hi,

Can i know which value corresponds to old area and new area because i can't find any views corresponding to new area.

Thanking you,
Priyanka Bandaru
Comment 7 Janek Bevendorff 2017-02-19 00:48:05 UTC
Is this still being worked on? It annoys the crap out of me that every time I start debugging, I completely lose track of where in the code I am.
One more thing that annoys me is that the view doesn't automatically jump to the current line when stopping at a break point or crashing. I always have to open the Frame Stack window (which also isn't opened by default and quite hidden inside the menus) and click on an entry in the stack trace first.
Comment 8 Mykola 2018-12-24 12:49:13 UTC
Hi,
I try out the solution proposed by @Alexander Dymo and it works partially because in addition we need to synchronize a new created view->widget with the active widget in code are. That makes code quite complicated and not readable

As for me the working solution is to have a property "Switch to Debug Area" setting to true by default that you could configure by yourself if you are annoying with this issue
Comment 9 Christoph Roick 2021-05-24 12:03:39 UTC
Git commit 74548158dc6d43a7b202a7a34e1e48d9a3f21a8e by Christoph Roick.
Committed on 23/05/2021 at 11:28.
Pushed by croick into branch 'master'.

Maintain working set state when switching between areas

Save the working set state before switching areas (i.e. from code
to debug). This allows restoring the order of the view tabs and the
current cursor positions in the new area.

M  +4    -1    kdevplatform/shell/areadisplay.cpp
M  +2    -2    kdevplatform/shell/debugcontroller.cpp
M  +4    -2    kdevplatform/shell/tests/test_workingsets.cpp
M  +1    -0    kdevplatform/shell/uicontroller.cpp
M  +18   -15   kdevplatform/shell/workingsetcontroller.cpp
M  +5    -2    kdevplatform/shell/workingsetcontroller.h
M  +1    -1    kdevplatform/shell/workingsets/closedworkingsetswidget.cpp
M  +1    -1    kdevplatform/shell/workingsets/closedworkingsetswidget.h
M  +2    -2    kdevplatform/shell/workingsets/workingsetwidget.cpp
M  +1    -1    kdevplatform/shell/workingsets/workingsetwidget.h
M  +5    -4    kdevplatform/sublime/area.cpp
M  +3    -3    kdevplatform/sublime/area.h
M  +1    -1    plugins/patchreview/patchreview.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/74548158dc6d43a7b202a7a34e1e48d9a3f21a8e
Comment 10 Alexander Dymo 2021-05-24 17:50:43 UTC
Thanks, Christoph!