Bug 337891 - Synchronise editor windows between Code and Debug modes
Summary: Synchronise editor windows between Code and Debug modes
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: UI: tabbed pages (show other bugs)
Version: 5.1.0
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 345308 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-30 03:22 UTC by Manu
Modified: 2021-05-24 17:50 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!